Build · Create · Engineering
Slugify function
A correct slugify(text) that passes the held-out cases.
You receive: A reviewed slugify function + the passing test report.
Part of Ship MVP
What's verified: STUD verifies your slugify(text) reproduces the reference slug on held-out cases: the text is lowercased, every run of non-alphanumeric characters is collapsed to a single hyphen, and leading and trailing hyphens are trimmed. Non-ASCII letters are treated as separators, not transliterated, so 'Café au lait' becomes 'caf-au-lait'. STUD does NOT check performance, code style, or any behavior beyond matching the reference output.
Opens soon
This play is verified and ready. It opens soon, once sign-in and payments are live.
Example
A sample of what this play produces. Your result is generated for your inputs.
import re
def slugify(inp):
"""Lowercase, collapse every run of non-alphanumeric characters to one
hyphen, and strip leading/trailing hyphens (ASCII slug)."""
s = re.sub(r"[^a-z0-9]+", "-", str(inp).lower())
return s.strip("-")
# slugify(" Hello, World! ") -> "hello-world"
# slugify("Node.js & TypeScript") -> "node-js-typescript"Get early access to STUD the day it goes live.