String Functions
Built-in string manipulation functions
String Functions
String functions are available globally and do not require an import.
Length
len
Get the length of a string or list.
Syntax: call len with value
set text to "Hello"
set length to call len with text # Returns 5
set numbers to list 1, 2, 3
set count to call len with numbers # Returns 3Case Conversion
uppercase
Convert a string to uppercase.
Syntax: call uppercase with string
set text to "Hello World"
set upper to call uppercase with text # Returns "HELLO WORLD"lowercase
Convert a string to lowercase.
Syntax: call lowercase with string
set text to "Hello World"
set lower to call lowercase with text # Returns "hello world"Trimming
trim
Remove leading and trailing whitespace from a string.
Syntax: call trim with string
set text to " hello world "
set trimmed to call trim with text # Returns "hello world"Splitting and Joining
split
Split a string into a list of substrings using a delimiter.
Syntax: call split with string, delimiter
set text to "apple,banana,cherry"
set fruits to call split with text, "," # Returns ["apple", "banana", "cherry"]join
Join a list of strings into a single string using a delimiter.
Syntax: call join with list, delimiter
set words to list "Hello", "World"
set sentence to call join with words, " " # Returns "Hello World"Searching
contains
Check if a string contains a substring.
Syntax: call contains with string, substring
Returns: true if found, false otherwise
set text to "Hello World"
set has_hello to call contains with text, "Hello" # Returns true
set has_xyz to call contains with text, "xyz" # Returns falsestarts_with
Check if a string starts with a prefix.
Syntax: call starts_with with string, prefix
set text to "Hello World"
set result to call starts_with with text, "Hello" # Returns trueends_with
Check if a string ends with a suffix.
Syntax: call ends_with with string, suffix
set text to "Hello World"
set result to call ends_with with text, "World" # Returns trueReplacing
replace
Replace all occurrences of a substring with another substring.
Syntax: call replace with string, old, new
set text to "Hello World"
set replaced to call replace with text, "World", "Kronos" # Returns "Hello Kronos"