Str Handl
str-handl.camel_case
Converts s to camelCase.
Signature: str-handl.camel_case((s))
Examples:
`str.camel_case("hello_world-again")`
-- => "helloWorldAgain"str-handl.capitalize
Uppercases the first character of s and lowercases the rest.
@param {s} - the input string
Signature: str-handl.capitalize((s))
Examples:
`str.capitalize("hELLO")`
-- => "Hello"str-handl.char_at
The character of s at index i.
Signature: str-handl.char_at((s, i))
Examples:
`str.char_at("hello", 1)`
-- => "e"str-handl.concat
Concatenates a and b.
@param {a} - the left string @param {b} - the right string
Signature: str-handl.concat((a, b))
Examples:
`str.concat("foo", "bar")`
-- => "foobar"str-handl.contains
Whether pat occurs anywhere in s.
@param {s} - the haystack @param {pat} - the needle
Signature: str-handl.contains((s, pat))
Examples:
`str.contains("hello", "ell")`
-- => truestr-handl.count
The number of non-overlapping occurrences of pat in s.
Signature: str-handl.count((s, pat))
Examples:
`str.count("aXbXc", "X")`
-- => 2str-handl.ends_with
Whether s ends with pat.
@param {s} - the input string @param {pat} - the suffix to test
Signature: str-handl.ends_with((s, pat))
Examples:
`str.ends_with("hello", "lo")`
-- => truestr-handl.equals
Whether a and b are character-for-character equal.
@param {a} - the left string @param {b} - the right string
Signature: str-handl.equals((a, b))
Examples:
`str.equals("a", "a")`
-- => truestr-handl.find
The char index of the first occurrence of pat in s, or -1.
Signature: str-handl.find((s, pat))
Examples:
`str.find("hello", "ll")`
-- => 2str-handl.is_alpha
Whether every character of s is alphabetic.
Signature: str-handl.is_alpha((s))
Examples:
`str.is_alpha("abc")`
-- => truestr-handl.is_alphanumeric
Whether every character of s is alphanumeric.
Signature: str-handl.is_alphanumeric((s))
Examples:
`str.is_alphanumeric("abc123")`
-- => truestr-handl.is_empty
Whether s is the empty string.
@param {s} - the input string
Signature: str-handl.is_empty((s))
Examples:
`str.is_empty("")`
-- => truestr-handl.is_numeric
Whether every character of s is numeric.
Signature: str-handl.is_numeric((s))
Examples:
`str.is_numeric("123")`
-- => truestr-handl.join
Joins the strings of xs with sep between each pair.
@param {xs} - the strings to join @param {sep} - the separator
Signature: str-handl.join((xs, sep))
Examples:
`str.join(["a", "b", "c"], "-")`
-- => "a-b-c"str-handl.kebab_case
Converts s to kebab-case.
Signature: str-handl.kebab_case((s))
Examples:
`str.kebab_case("helloWorld_again")`
-- => "hello-world-again"str-handl.length
The number of characters in s.
Signature: str-handl.length((s))
Examples:
`str.length("hello")`
-- => 5str-handl.levenshtein
The Levenshtein edit distance between a and b.
Signature: str-handl.levenshtein((a, b))
Examples:
`str.levenshtein("kitten", "sitting")`
-- => 3str-handl.lines
Splits s into lines.
Signature: str-handl.lines((s))
Examples:
`str.lines("a\nb\n")`
-- => ["a", "b"]str-handl.lower
Lowercases every character of s.
Signature: str-handl.lower((s))
Examples:
`str.lower("Hello")`
-- => "hello"str-handl.pad_left
Left-pads s to n chars by cycling the chars of p.
@param {s} - the input string @param {n} - the target length @param {p} - the pad pattern (empty p is a no-op)
Signature: str-handl.pad_left((s, n, p))
Examples:
`str.pad_left("ab", 5, "0")`
-- => "000ab"str-handl.pad_right
Right-pads s to n chars by cycling the chars of p.
@param {s} - the input string @param {n} - the target length @param {p} - the pad pattern (empty p is a no-op)
Signature: str-handl.pad_right((s, n, p))
Examples:
`str.pad_right("ab", 5, "0")`
-- => "ab000"str-handl.pascal_case
Converts s to PascalCase.
Signature: str-handl.pascal_case((s))
Examples:
`str.pascal_case("hello_world-again")`
-- => "HelloWorldAgain"str-handl.repeat
s concatenated with itself n times.
Signature: str-handl.repeat((s, n))
Examples:
`str.repeat("ab", 3)`
-- => "ababab"str-handl.replace
Replaces every non-overlapping occurrence of old in s with to.
Signature: str-handl.replace((s, old, to))
Examples:
`str.replace("aXbXc", "X", "-")`
-- => "a-b-c"str-handl.replace_first
Replaces the first occurrence of old in s with to.
Signature: str-handl.replace_first((s, old, to))
Examples:
`str.replace_first("aXbXc", "X", "-")`
-- => "a-bXc"str-handl.reverse
Reverses s by character.
@param {s} - the input string
Signature: str-handl.reverse((s))
Examples:
`str.reverse("abc")`
-- => "cba"str-handl.rfind
The char index of the last occurrence of pat in s, or -1.
Signature: str-handl.rfind((s, pat))
Examples:
`str.rfind("aXbXc", "X")`
-- => 3str-handl.similarity
A similarity score between a and b in [0.0, 1.0].
Signature: str-handl.similarity((a, b))
Examples:
`str.similarity("kitten", "sitting")`
-- => 0.5714...str-handl.slice
The substring of s between char indices a (inclusive) and b
(exclusive).
Signature: str-handl.slice((s, a, b))
Examples:
`str.slice("hello", 1, 4)`
-- => "ell"str-handl.slugify
Converts s to a URL-safe slug.
Signature: str-handl.slugify((s))
Examples:
`str.slugify("Hello, World!")`
-- => "hello-world"str-handl.snake_case
Converts s to snake_case.
Signature: str-handl.snake_case((s))
Examples:
`str.snake_case("helloWorld-again")`
-- => "hello_world_again"str-handl.split
Splits s on every non-overlapping occurrence of sep.
Signature: str-handl.split((s, sep))
Examples:
`str.split("a,b,c", ",")`
-- => ["a", "b", "c"]str-handl.split_at
Splits s at char index i into [head, tail].
Signature: str-handl.split_at((s, i))
Examples:
`str.split_at("hello", 2)`
-- => ["he", "llo"]str-handl.split_whitespace
Splits s on whitespace runs.
Signature: str-handl.split_whitespace((s))
Examples:
`str.split_whitespace(" a b \n c ")`
-- => ["a", "b", "c"]str-handl.starts_with
Whether s starts with pat.
@param {s} - the input string @param {pat} - the prefix to test
Signature: str-handl.starts_with((s, pat))
Examples:
`str.starts_with("hello", "he")`
-- => truestr-handl.strip_prefix
Removes the prefix p from s when present.
@param {s} - the input string @param {p} - the prefix to strip
Signature: str-handl.strip_prefix((s, p))
Examples:
`str.strip_prefix("hello", "he")`
-- => "llo"str-handl.strip_suffix
Removes the suffix p from s when present.
@param {s} - the input string @param {p} - the suffix to strip
Signature: str-handl.strip_suffix((s, p))
Examples:
`str.strip_suffix("hello", "lo")`
-- => "hel"str-handl.title_case
Titlecases s: uppercase after whitespace, lowercase elsewhere.
@param {s} - the input string
Signature: str-handl.title_case((s))
Examples:
`str.title_case("hello world")`
-- => "Hello World"str-handl.trim
Removes leading and trailing whitespace.
@param {s} - the input string
Signature: str-handl.trim((s))
Examples:
`str.trim(" hi ")`
-- => "hi"str-handl.trim_end
Removes trailing whitespace.
@param {s} - the input string
Signature: str-handl.trim_end((s))
Examples:
`str.trim_end(" hi ")`
-- => " hi"str-handl.trim_matches
Removes leading and trailing characters that appear in set.
Signature: str-handl.trim_matches((s, set))
Examples:
`str.trim_matches("xxhixx", "x")`
-- => "hi"str-handl.trim_start
Removes leading whitespace.
@param {s} - the input string
Signature: str-handl.trim_start((s))
Examples:
`str.trim_start(" hi ")`
-- => "hi "str-handl.truncate
Truncates s to at most m chars, appending "..." when cut.
Signature: str-handl.truncate((s, m))
Examples:
`str.truncate("hello world", 8)`
-- => "hello..."str-handl.upper
Uppercases every character of s.
Signature: str-handl.upper((s))
Examples:
`str.upper("Hello")`
-- => "HELLO"str-handl.word_wrap
Wraps s to lines of at most w chars on word boundaries.
Signature: str-handl.word_wrap((s, w))
Examples:
`str.word_wrap("the quick brown fox", 9)`
-- => "the quick\nbrown fox"