Skip to main content

📝 String Operations

Module: str/* | Operators: 26

Text manipulation including formatting, splitting, trimming, and templating.


Operator Reference

str/len

Length · 1 argument · returns number

String length

ParameterTypeDescription
sstringThe string
["str/len", "hello"] // => 5

str/upper

Upper · 1 argument · returns string

Convert to uppercase

ParameterTypeDescription
sstringThe string
["str/upper", "hello"] // => "HELLO"

str/lower

Lower · 1 argument · returns string

Convert to lowercase

ParameterTypeDescription
sstringThe string
["str/lower", "HELLO"] // => "hello"

str/trim

Trim · 1 argument · returns string

Remove leading and trailing whitespace

ParameterTypeDescription
sstringThe string
["str/trim", "  hello  "] // => "hello"

str/trimStart

Trim Start · 1 argument · returns string

Remove leading whitespace

ParameterTypeDescription
sstringThe string
["str/trimStart", "  hello"] // => "hello"

str/trimEnd

Trim End · 1 argument · returns string

Remove trailing whitespace

ParameterTypeDescription
sstringThe string
["str/trimEnd", "hello  "] // => "hello"

str/split

Split · 2 arguments · returns array

Split string into array by delimiter

ParameterTypeDescription
sstringThe string
delimstringDelimiter
["str/split", "a,b,c", ","] // => ["a", "b", "c"]

str/join

Join · 2 arguments · returns string

Join array elements into string

ParameterTypeDescription
arrarrayArray to join
delimstringDelimiter
["str/join", ["a", "b", "c"], ", "] // => "a, b, c"

str/slice

Slice · 2–3 arguments · returns string

Extract substring

ParameterTypeDescription
sstringThe string
startnumberStart index
endnumberEnd index (exclusive)
["str/slice", "hello", 1, 4] // => "ell"

str/replace

Replace · 3 arguments · returns string

Replace first occurrence

ParameterTypeDescription
sstringThe string
findstringString to find
replacestringReplacement
["str/replace", "hello world", "world", "there"] // => "hello there"

str/replaceAll

Replace All · 3 arguments · returns string

Replace all occurrences

ParameterTypeDescription
sstringThe string
findstringString to find
replacestringReplacement
["str/replaceAll", "a-b-c", "-", "_"] // => "a_b_c"

str/includes

Includes · 2 arguments · returns boolean

Check if string contains substring

ParameterTypeDescription
sstringThe string
searchstringSubstring to find
["str/includes", "hello world", "world"] // => true

str/startsWith

Starts With · 2 arguments · returns boolean

Check if string starts with prefix

ParameterTypeDescription
sstringThe string
prefixstringPrefix to check
["str/startsWith", "hello", "hel"] // => true

str/endsWith

Ends With · 2 arguments · returns boolean

Check if string ends with suffix

ParameterTypeDescription
sstringThe string
suffixstringSuffix to check
["str/endsWith", "hello", "lo"] // => true

str/padStart

Pad Start · 2–3 arguments · returns string

Pad string from start to target length

ParameterTypeDescription
sstringThe string
lennumberTarget length
charstringPadding character
["str/padStart", "5", 3, "0"] // => "005"

str/padEnd

Pad End · 2–3 arguments · returns string

Pad string from end to target length

ParameterTypeDescription
sstringThe string
lennumberTarget length
charstringPadding character
["str/padEnd", "5", 3, "0"] // => "500"

str/repeat

Repeat · 2 arguments · returns string

Repeat string n times

ParameterTypeDescription
sstringThe string
countnumberRepeat count
["str/repeat", "ab", 3] // => "ababab"

str/reverse

Reverse · 1 argument · returns string

Reverse string

ParameterTypeDescription
sstringThe string
["str/reverse", "hello"] // => "olleh"

str/capitalize

Capitalize · 1 argument · returns string

Capitalize first character

ParameterTypeDescription
sstringThe string
["str/capitalize", "hello"] // => "Hello"

str/titleCase

Title Case · 1 argument · returns string

Convert to Title Case

ParameterTypeDescription
sstringThe string
["str/titleCase", "hello world"] // => "Hello World"

str/camelCase

Camel Case · 1 argument · returns string

Convert to camelCase

ParameterTypeDescription
sstringThe string
["str/camelCase", "hello world"] // => "helloWorld"

str/kebabCase

Kebab Case · 1 argument · returns string

Convert to kebab-case

ParameterTypeDescription
sstringThe string
["str/kebabCase", "Hello World"] // => "hello-world"

str/snakeCase

Snake Case · 1 argument · returns string

Convert to snake_case

ParameterTypeDescription
sstringThe string
["str/snakeCase", "Hello World"] // => "hello_world"

str/default

Default · 2 arguments · returns string

Return default if value is null/undefined/empty

ParameterTypeDescription
sstring | nullThe value
defaultstringDefault value
["str/default", null, "N/A"] // => "N/A"

str/template

Template · 2 arguments · returns string

Variable substitution in template string

ParameterTypeDescription
templatestringTemplate with {placeholders}
varsobjectVariables to substitute
["str/template", "Hello, {name}!", {"name": "World"}] // => "Hello, World!"

str/truncate

Truncate · 2–3 arguments · returns string

Truncate string with optional suffix

ParameterTypeDescription
sstringThe string
lennumberMaximum length
suffixstringSuffix for truncated strings
["str/truncate", "Hello World", 8, "..."] // => "Hello..."