String Transforms
String transforms operate on string values using the pipe syntax: value | transformName(args).
upper
Converts a string to uppercase.
"hello" | upper // "HELLO"
lower
Converts a string to lowercase.
"HELLO" | lower // "hello"
capitalize
Capitalizes the first character of a string.
"hello" | capitalize // "Hello"
swapCase
Swaps the case of each character in a string.
"Hello" | swapCase // "hELLO"
startsWith
Checks if a string starts with a given substring.
"hello" | startsWith('he') // true
endsWith
Checks if a string ends with a given substring.
"hello" | endsWith('lo') // true
indexOfChar
Returns the index of the first occurrence of a character.
"hello" | indexOfChar('l') // 2
trim
Removes whitespace from both ends of a string.
" hello " | trim // "hello"
ltrim
Removes whitespace from the start of a string.
" hello" | ltrim // "hello"
rtrim
Removes whitespace from the end of a string.
"hello " | rtrim // "hello"
length
Returns the length of a string.
"hello" | length // 5
replace
Replaces the first occurrence of a pattern with a replacement string. Supports regex patterns.
"hello world" | replace('world', 'there') // "hello there"
"hello 123" | replace('[0-9]+', 'XXX') // "hello XXX"
replaceAll
Replaces all occurrences of a pattern with a replacement string. Supports regex patterns.
"a,b,c" | replaceAll(',', '|') // "a|b|c"
split
Splits a string by a delimiter into an array. Supports regex.
"a,b,c" | split(',') // ["a", "b", "c"]
substring
Returns a substring between two indices.
"hello" | substring(1, 4) // "ell"
padStart
Pads the start of a string to a given length.
"5" | padStart(3, '0') // "005"
padEnd
Pads the end of a string to a given length.
"5" | padEnd(3, '0') // "500"
parseInt
Parses a string to an integer with an optional radix.
"42" | parseInt // 42
"FF" | parseInt(16) // 255
parseFloat
Parses a string to a floating-point number.
"3.14" | parseFloat // 3.14
toBoolean
Converts the string "true" to true, anything else to false.
"true" | toBoolean // true
"false" | toBoolean // false
reverse
Reverses the characters in a string.
"hello" | reverse // "olleh"
slugify
Encodes a string as a URI component.
"hello world" | slugify // "hello%20world"
unslugify
Decodes a URI component back to a string.
"hello%20world" | unslugify // "hello world"