text
case, splitting, search, regex; encodings, ciphers and more below
Example results generated on 2026-10-08. Ones using
now,todayor randomness will differ when you run them: press Run on any example to run it in your browser, after editing it if you like.
types
# str
"héllo\tworld"
# regex
r"\d+"
operators
# str + v
"v" + 2
# → "v2"
# str * int
"ab" * 3
# → "ababab"
Submodules
| module | about |
|---|---|
| layout | pad, center, wrap, truncate, dedent; snake_case, camelCase, slugs; words |
| compare | edit distance, similarity, the closest of a list, line-by-line diffs |
| translation | translate text between languages online; cached translations work offline |
| encoding | base64, base32, base58, URL and hex encodings, UTF-8 bytes, hex dumps |
| hash | SHA-1/256/512, MD5, HMAC and CRC-32 of strings |
| ciphers | Caesar, ROT13, Atbash, Vigenère, Morse, Braille, NATO spelling |
| fancy | mock case, l33t, uwu, Pig Latin, zalgo, upside-down, 𝐛𝐨𝐥𝐝/𝒮𝒸𝓇𝒾𝓅𝓉/wide |
| placeholder | lorem ipsum placeholder text, random team and person names |
Functions
| function | description |
|---|---|
upper(s: str) | uppercase a string |
lower(s: str) | lowercase a string |
trim(s: str) | strip leading and trailing whitespace |
capitalize(s: str) | uppercase the first character |
split(s: str, sep?: str|regex) | split on sep (string or regex); whitespace if omitted |
lines(s: str) | split into lines |
chars(s: str) | list of characters |
join(xs: list, sep?: str) | join items into a string |
replace(s: str, pat: str|regex, with: str) | replace all matches; regex replacements can use $1 |
starts_with(s: str, prefix: str) | whether s starts with prefix |
ends_with(s: str, suffix: str) | whether s ends with suffix |
match(s: str, re: regex) | first match, its capture groups, or nil |
find_all(s: str, pat: str|regex) | list of all matches |
grep(v: str|list, pat: str|regex) | lines of a string (or items of a list) containing pat |
repeat(s: str, n: int) | repeat a string n times |
nums(s: str) | every number in a string |
strip_ansi(s: str) | remove terminal color and cursor codes |
upper
upper(s: str): uppercase a string
"hello".upper
# → "HELLO"
upper("zil")
# → "ZIL"
See also: lower, capitalize
lower
lower(s: str): lowercase a string
"HeLLo".lower
# → "hello"
See also: upper, capitalize
trim
trim(s: str): strip leading and trailing whitespace
" hi ".trim
# → "hi"
See also: split
capitalize
capitalize(s: str): uppercase the first character
"hello world".capitalize
# → "Hello world"
See also: upper
split
split(s: str, sep?: str|regex): split on sep (string or regex); whitespace if omitted
"a b c".split
# → ["a", "b", "c"]
"x,y;z".split(r"[,;]")
# → ["x", "y", "z"]
lines
lines(s: str): split into lines
"a\nb".lines
# → ["a", "b"]
See also: split
chars
chars(s: str): list of characters
"abc".chars
# → ["a", "b", "c"]
See also: split
join
join(xs: list, sep?: str): join items into a string
["a", "b"].join("-")
# → "a-b"
[1, 2].join
# → "12"
See also: split
replace
replace(s: str, pat: str|regex, with: str): replace all matches; regex replacements can use $1
"a.b".replace(".", "-")
# → "a-b"
"a b c".replace(r"\s+", " ")
# → "a b c"
starts_with
starts_with(s: str, prefix: str): whether s starts with prefix
"abc".starts_with("a")
# → true
ends_with
ends_with(s: str, suffix: str): whether s ends with suffix
"file.zil".ends_with(".zil")
# → true
See also: starts_with
match
match(s: str, re: regex): first match, its capture groups, or nil
"2026-10-06".match(r"(\d+)-(\d+)")
# → ["2026", "10"]
"id 42".match(r"\d+")
# → "42"
find_all
find_all(s: str, pat: str|regex): list of all matches
"a1b22c333".find_all(r"\d+")
# → ["1", "22", "333"]
grep
grep(v: str|list, pat: str|regex): lines of a string (or items of a list) containing pat
"ok\nERROR 1\nERROR 2".grep("ERROR")
# → ["ERROR 1", "ERROR 2"]
["a1", "b", "c22"].grep(r"\d")
# → ["a1", "c22"]
See also: lines, filter, contains
repeat
repeat(s: str, n: int): repeat a string n times
"ab".repeat(3)
# → "ababab"
nums
nums(s: str): every number in a string
"x=3, y=-2.5; 1e3".nums
# → [3, -2.5, 1000]
strip_ansi
strip_ansi(s: str): remove terminal color and cursor codes
gradient("ab", "red", "blue").strip_ansi
# → "ab"
More examples
text
# numbers out of text
"a1b22c333".nums.sum
# → 356
# regex captures
"2026-10-06".match(r"(\d+)-(\d+)-(\d+)")
# → ["2026", "10", "06"]
# regex replace with $1
"CamelCaseName".replace(r"(\B[A-Z])", " $1")
# → "Camel Case Name"
# grep lines
"ok\nERROR disk full\nok".grep(r"ERROR")
# → ["ERROR disk full"]
# initials
"Ada Lovelace".split.map(|w| w[0]).join
# → "AL"
# printf
format("%-6s|%5.2f", "pi", pi)
# → "pi | 3.14"