Skip to content

Text

Use this when concatenating, formatting, splitting, searching, or matching strings.

FunctionSignatureDescriptionExample
catt t > tConcatenate two stringscat "hello" " world" -> "hello world"
lent > nString lengthlen "hello" -> 5
trmt > tTrim whitespacetrm " hi " -> "hi"
splt t > L tSplit string by delimiterspl "a,b,c" "," -> ["a","b","c"]
hast t > bCheck if string contains substringhas "hello" "ell" -> true
idxoft t > O nFirst code-point index of substring, or nil. Empty needle returns 0 (Python/JS convention). Pair with slc for split-on-first-occurrence. (ILO-39, 26.5)idxof "key=value" "=" -> 3
FunctionSignatureDescriptionExample
rgxt t > L tRegex match (returns captures)rgx "abc123" "[0-9]+" -> ["123"]
rgxallt t > L (L t)All matches with captures, one inner list per match. With no capture groups, each inner list holds the whole match.rgxall "(\\w+)=(\\d+)" "a=1 b=2" -> [["a","1"],["b","2"]]
rgxall1t t > L tAll matches of a single-group pattern, flattened. With no capture groups, returns the list of whole matches. Errors at verify-time if the pattern has 2+ capture groups, use rgxall instead.rgxall1 "(\\d+)" "a=1 b=2" -> ["1","2"]
rgxall-multiL t t > L tMulti-pattern flat-match. Apply each pattern in the list to the string and concatenate hits in pattern order. Per-pattern semantics follow rgxall1 (0 groups -> whole matches; 1 group -> capture-1 strings; 2+ groups errors).rgxall-multi ["\\d+" "[A-Z]+"] "x=1 ERR=2" -> ["1","2","ERR"]
FunctionSignatureDescriptionExample
fmtt ... > tFormat string with valuesfmt "{.2f} {:5}" 3.14159 42
fmt2n n > tFormat a number to N decimal places (half-to-even rounding; digits clamped to 0..=20). Decimal formatter, not a list-splat variant of fmt. Compose with fmt for template + precision.fmt2 3.14159 2 -> "3.14", fmt "x={}" (fmt2 v 2)

fmt is pure-functional sprintf, not print. A bare fmt "..." v statement is silently discarded on every engine. Use prnt fmt "..." v to print or line=fmt "..." v to capture. The verifier emits ILO-T032 when fmt/fmt2 is a non-tail statement with no binding (tail position, e.g. f v:n>t;fmt "x={}" v, is the documented “return formatted text” idiom and does not warn).

Supported placeholder specs:

SpecMeaningExample
{}Any valuefmt "{}" 42"42"
{.Nf} / {:.Nf}N decimal placesfmt "{.2f}" 3.14159"3.14"
{:N}Right-align to width Nfmt "{:5}" "hi"" hi"
{:Nd}Integer, right-aligned to width Nfmt "{:5d}" 42.0" 42"
{:<N}Left-align to width Nfmt "{:<5}" "hi""hi "

Zero-padded widths ({:06d}) and {:.N} without the f suffix are rejected at verify-time when the template is a literal, or at runtime otherwise.

FunctionSignatureDescriptionExample
str_ > tConvert any value to stringstr 42 -> "42"
numt|n > R n tPolymorphic: parse text or identity-wrap a number as Ok. Saves the num (str x) roundtrip when x may already be numeric (e.g. from jpar! on a JSON number)num "42" -> Ok 42, num 42 -> Ok 42
FunctionSignatureDescriptionExample
prnt_ > _Print value and return itprnt "hello"
Long formShort form
concatcat
lengthlen
trimtrm
splitspl
containshas
formatfmt
regexrgx
printprnt