Text

Functions for working with text (UTF-8 strings) and character values. Read the value of a variable and put a reference to it on the stack

pub fn len(both: text) -> integer

Number of bytes in the text. Use for bounds checks and iteration limits.

pub fn len(both: character) -> integer

Byte length of the character's UTF-8 encoding (1–4).

Splits self on every occurrence of separator and returns the parts as a vector. Use to parse CSV lines or space-separated tokens.

pub fn split(self: text, separator: character) -> vector < text >
pub fn starts_with(self: text, value: text) -> boolean

Functions for searching, transforming, and classifying text and character values. Character classification functions return true only if every character in the text satisfies the condition. The single-character variants test one code point. Returns true if self begins with value. Use for prefix matching (e.g., protocol detection).

pub fn ends_with(self: text, value: text) -> boolean

Returns true if self ends with value. Use for suffix matching (e.g., file extension checks).

pub fn trim(both: text) -> text[both]

Removes leading and trailing whitespace. Use when processing user input or file content.

pub fn trim_start(self: text) -> text[self]

Removes leading whitespace only.

pub fn trim_end(self: text) -> text[self]

Removes trailing whitespace only.

pub fn find(self: text, value: text) -> integer

Returns the byte index of the first occurrence of value, or null if not found. Use to locate substrings before slicing.

pub fn rfind(self: text, value: text) -> integer

Returns the byte index of the last occurrence of value, or null if not found. Use to find file extensions or the last path separator.

pub fn contains(self: text, value: text) -> boolean

Returns true if value appears anywhere in self. Simpler than find when you only need a yes/no answer.

pub fn replace(self: text, value: text, with: text) -> text

Returns a copy of self with every occurrence of value replaced by with.

pub fn to_lowercase(self: text) -> text

Returns a lowercase copy. Use for case-insensitive comparisons.

pub fn to_uppercase(self: text) -> text

Returns an uppercase copy.

pub fn is_lowercase(self: text) -> boolean

True if all characters are lowercase letters.

pub fn is_lowercase(self: character) -> boolean

True if the character is a lowercase letter.

pub fn is_uppercase(self: text) -> boolean

True if all characters are uppercase letters.

pub fn is_uppercase(self: character) -> boolean

True if the character is an uppercase letter.

pub fn is_numeric(self: text) -> boolean

True if all characters are numeric digits (Unicode numeric, not just ASCII 0–9).

pub fn is_numeric(self: character) -> boolean

True if the character is a numeric digit.

pub fn is_alphanumeric(self: text) -> boolean

True if all characters are letters or digits. Use to validate identifiers or tokens.

pub fn is_alphanumeric(self: character) -> boolean

True if the character is a letter or digit.

pub fn is_alphabetic(self: text) -> boolean

True if all characters are alphabetic.

pub fn is_alphabetic(self: character) -> boolean

True if the character is alphabetic.

pub fn is_whitespace(self: text) -> boolean

True if all characters are whitespace. Use to detect blank lines.

pub fn is_control(self: text) -> boolean

True if all characters are control characters.

pub fn join(parts: vector < text >, sep: text) -> text

Joins parts with sep between each consecutive pair. Returns "" for an empty vector. Use to build comma-separated lists, path segments, or any delimited output.