Otter
Snippets
Otter
Upstream Otter 1.0.1 Tested
Convert Text to URL Slug
Transform titles and text into clean, lowercase, hyphenated URL slugs.
Architecture & Runtime Preview
Otter 1.0.1Zero-dependency Otter 1.0.1 snippet (Text & Strings). Copy the parameterized template or run the self-contained example.
- 1Category: Text & Strings
- 2Attribution: Otter Reusable Library (Official)
- 3Zero external pack dependencies — paste directly into any .ot file
Source Code (2 files)
to slugify text
clean is lowercase of text
replace " " with "-" in clean
replace "_" with "-" in clean
return clean
.
to slugify text
clean is lowercase of text
replace " " with "-" in clean
replace "_" with "-" in clean
return clean
.
slug is slugify "Otter Language Release 2026"
say "Slug:" slug
if slug is not "otter-language-release-2026"
fail with "slugify mismatch: expected otter-language-release-2026"
.
Installation & Usage
otter snippet inspect text-slugify
Copy template.ot directly into your .ot source file, or run example.ot with 'otter run example.ot'.