upper, lower, trim, replace, split, join, printf and friends.
The string builtins. Most are callable as a function, a pipe target, or
(where the arity allows) a method. The standard squiggly convention is
data-last: in pipe form s | trim becomes trim s, in
s | replace 'a' 'b' it becomes replace 'a' 'b' s. The tables below
list the function-call signature in left-to-right order; pipe form
threads the piped value in as the last argument.
Case & whitespace
Function
Arity
Signature
What
upper
1
upper s
Uppercase
lower
1
lower s
Lowercase
capitalize
1
capitalize s
Uppercase the first letter
trim
1
trim s
Strip leading + trailing whitespace
ltrim
1
ltrim s
Strip leading whitespace only
rtrim
1
rtrim s
Strip trailing whitespace only
newline_to_br
1
newline_to_br s
Replace \n with <br />
Predicates & search
Function
Arity
Signature
What
length
1
length s
Number of characters (works on lists / maps too)
isEmpty
1
isEmpty s
True iff length is zero
nonEmpty
1
nonEmpty s
True iff length is non-zero
startsWith
2
startsWith prefix s
True iff s starts with prefix
endsWith
2
endsWith suffix s
True iff s ends with suffix
contains
2
contains needle s
True iff s contains needle
Slicing & shaping
Function
Arity
Signature
What
reverse
1
reverse s
Reverse the string
substring
2/3
substring from s / substring from until s
Half-open slice; from/until are character indices
truncate
2/3
truncate n s / truncate n ellipsis s
Truncate to n words; appends ellipsis (default …) when shortened