strings
native moduleString operations. import "strings". Strings are codepoint-indexed — including index_of and slice below; byte_count is the one exception, giving the UTF-8 byte length instead.
For higher-level helpers (padding,
title_case, words, snake/camel case conversion, truncate, …) see the strings_ext library module.strings.split(s, sep: string) => [string]strings.join(list: [any], sep: string) => stringstrings.contains(s, sub: string) => boolstrings.starts_with(s, prefix: string) => boolstrings.ends_with(s, suffix: string) => boolstrings.replace(s, old, new: string) => stringstrings.trim(s: string) => stringstrings.trim_left(s) / trim_right(s) => stringstrings.to_upper(s) / to_lower(s) => stringstrings.repeat(s: string, count: int) => stringstrings.index_of(s, sub: string) => intstrings.slice(s: string, start: int, end: int?) => stringstrings.reverse(s: string) => stringstrings.chars(s: string) => [string]strings.byte_count(s: string) => int
strings.split(s, sep: string) => [string]
Split s on every sep.
strings.join(list: [any], sep: string) => string
Join rendered elements with sep.
strings.contains(s, sub: string) => bool
Is sub a substring of s.
strings.starts_with(s, prefix: string) => bool
Does s begin with prefix.
strings.ends_with(s, suffix: string) => bool
Does s end with suffix.
strings.replace(s, old, new: string) => string
Replace all old with new.
strings.trim(s: string) => string
Strip leading+trailing whitespace.
strings.trim_left(s) / trim_right(s) => string
Strip one side.
strings.to_upper(s) / to_lower(s) => string
Case conversion.
strings.repeat(s: string, count: int) => string
count copies concatenated.
strings.index_of(s, sub: string) => int
Codepoint index of first sub, or -1.
strings.slice(s: string, start: int, end: int?) => string
Substring by codepoint index (end optional, indices clamped).
strings.reverse(s: string) => string
Reverse the characters.
strings.chars(s: string) => [string]
One single-codepoint string per character.
strings.byte_count(s: string) => int
UTF-8 byte length (not codepoints).