Strings
string(value: unknown): stringConverts any value to its string representation (JSON for objects and arrays).
length(value: string): numberNumber of characters in the string.
contains(value: string, substring: string): booleanTrue if the string contains the given substring.
matches(value: string, pattern: string): booleanTrue if the string matches the regular expression `pattern`.
upper(value: string): stringUppercases the string.
lower(value: string): stringLowercases the string.
trim(value: string): stringRemoves leading and trailing whitespace.
pad(value: string, width: number, char?: string): stringPads to `width` with `char` (default space); a negative width pads on the left.
substring(value: string, start: number, length?: number): stringExtracts `length` characters from `start`; a negative start counts from the end.
split(value: string, separator: string, limit?: number): string[]Splits on a separator, optionally keeping only the first `limit` parts.
replace(value: string, pattern: string, replacement: string): stringReplaces every occurrence of `pattern` with `replacement`.
base64encode(value: string): stringEncodes the string to Base64 (UTF-8 safe).
base64decode(value: string): stringDecodes a Base64 string (UTF-8 safe).
encodeUrl(value: string): stringEncodes a full URL (`encodeURI`).
decodeUrl(value: string): stringDecodes a full URL (`decodeURI`).
encodeUrlComponent(value: string): stringEncodes a URL component (`encodeURIComponent`).
decodeUrlComponent(value: string): stringDecodes a URL component (`decodeURIComponent`).
Conversion
string
string(value: unknown): stringConverts any value to its string representation (JSON for objects and arrays).
label: "Order #" + string(order.id)Inspect
length
length(value: string): numberNumber of characters in the string.
nameLength: length(user.name)contains
contains(value: string, substring: string): booleanTrue if the string contains the given substring.
isWorkEmail: contains(user.email, "@work.")matches
matches(value: string, pattern: string): booleanTrue if the string matches the regular expression pattern.
isZip: matches(user.zip, "^[0-9]{5}$")Case & whitespace
upper
upper(value: string): stringUppercases the string.
shout: upper(user.name)lower
lower(value: string): stringLowercases the string.
handle: lower(user.username)trim
trim(value: string): stringRemoves leading and trailing whitespace.
clean: trim(user.rawName)pad
pad(value: string, width: number, char?: string): stringPads to width with char (default space); a negative width pads on the left.
padded: pad(user.ref, -8, "0")Transform
substring
substring(value: string, start: number, length?: number): stringExtracts length characters from start; a negative start counts from the end.
initials: substring(user.name, 0, 1)split
split(value: string, separator: string, limit?: number): string[]Splits on a separator, optionally keeping only the first limit parts.
domain: split(user.email, "@")[1]replace
replace(value: string, pattern: string, replacement: string): stringReplaces every occurrence of pattern with replacement.
masked: replace(user.email, "a", "*")Encoding
base64encode
base64encode(value: string): stringEncodes the string to Base64 (UTF-8 safe).
token: base64encode(user.id + ":" + user.secret)base64decode
base64decode(value: string): stringDecodes a Base64 string (UTF-8 safe).
decoded: base64decode(request.token)encodeUrl
encodeUrl(value: string): stringEncodes a full URL (encodeURI).
link: encodeUrl(page.canonicalUrl)decodeUrl
decodeUrl(value: string): stringDecodes a full URL (decodeURI).
link: decodeUrl(request.rawUrl)encodeUrlComponent
encodeUrlComponent(value: string): stringEncodes a URL component (encodeURIComponent).
query: encodeUrlComponent(search.term)decodeUrlComponent
decodeUrlComponent(value: string): stringDecodes a URL component (decodeURIComponent).
term: decodeUrlComponent(request.query)Playground
{ "local": "ada", "domain": "work.dev", "padded": "00000042", "isWorkEmail": true, "masked": "*d*@work.dev", "shout": "ADA" }
{
local: string;
domain: string;
padded: string;
isWorkEmail: boolean;
masked: string;
shout: string;
}