Casing

toLowerCase

Converts the characters of a string to lowercase.

Usage

<string>.toLowerCase()

Returns

A lowercase version of the original string.

Examples

ExpressionResult
"AbcDe".toLowerCase()"abcde"

toUpperCase

Converts the characters of a string to uppercase.

Usage

<string>.toUpperCase()

Returns

An uppercase version of the original string.

Examples

ExpressionResult
"abcDe".toUpperCase()"ABCDE"

Encoding

fromBase64

Decodes a Base64-encoded string.

Usage

<string>.fromBase64()

Returns

The decoded string.

Examples

ExpressionResult
"YWJjZDEyMzQ=".fromBase64()"abcd1234"

htmlDecode

Decodes an HTML-encoded string.

Usage

<string>.htmlDecode()

Returns

The decoded string.

Examples

ExpressionResult
"String with &#39;&amp;&#39;, &#39;<&#39;, &#39;&gt;&#39; characters".htmlDecode()"String with '&', '<', '>' characters"

htmlEncode

Encodes a string as an HTML string value.

Usage

<string>.htmlEncode()

Returns

The encoded string.

Examples

ExpressionResult
"String with '&', '<', '>' characters".htmlEncode()"String with &#39;&amp;&#39;, &#39;<&#39;, &#39;&gt;&#39; characters"

jsEncode

Encodes a string as a JavaScript string value.

Usage

<string>.jsEncode()

Returns

The encoded string.

Examples

ExpressionResult
"String with '&', '<', '>' characters".jsEncode()"String with \u0027\u0026\u0027, \u0027\u003c\u0027, \u0027\u003e\u0027 characters"

toBase64String

Encodes a string as its Base64 representation.

Usage

<string>.toBase64String()

Returns

The encoded string.

Examples

ExpressionResult
"abcd1234".toBase64()"YWJjZDEyMzQ="

urlDecode

Decodes a URL-encoded string.

Usage

<string>.urlDecode()

Returns

The decoded string.

Examples

ExpressionResult
"https%3a%2f%2fwww.bing.com%2f".urlDecode()"https://www.bing.com/"

urlEncode

Encodes a string in a URL-safe format.

Usage

<string>.urlEncode()

Returns

The encoded string.

Examples

ExpressionResult
"https://www.bing.com/".urlEncode()"https%3a%2f%2fwww.bing.com%2f"

Padding

padLeft

Creates a string with the specified length. The beginning of the string is padded with whitespace or the specified character.

Usage

<string>.padLeft(<totalWidth>, <paddingChar>)

Parameters

NameTypeRequiredDescription
totalWidthnumberYesThe number of characters in the resulting string. This is the number of characters in the original string, plus any padding characters.
paddingCharstringNoThe character to use for padding the string. The default value is a single space.

Returns

A string prefixed with the number of paddingChar characters required for the string's length to equal the totalWidth.

Examples

ExpressionResult
"abcde".padLeft(10, "x")"xxxxxabcde"

padRight

Creates a string with the specified length. The end of the string is padded with whitespace or the specified character.

Usage

<string>.padRight(<totalWidth>, <paddingChar>)

Parameters

NameTypeRequiredDescription
totalWidthnumberYesThe number of characters in the resulting string. This is the number of characters in the original string, plus any padding characters.
paddingCharstringNoThe character to use for padding the string. The default value is a single space.

Returns

A string, postfixed with the number of paddingChar characters required for the string's length to equal the totalWidth.

Examples

ExpressionResult
"abcde".padRight(10, "x")"abcdexxxxx"

Replacing

regexReplace

Searches a string for a regular expression and replaces them with a string.

Usage

<string>.regexMatches(<pattern>, <replacement>, <ignoreCase>)

Parameters

NameTypeRequiredDescription
patternstringYesA regular expression pattern.
replacementstringYesThe value to replace the matched strings with.
ignoreCasebooleanNoIf true, the pattern will be case-insensitive. The default value is false.

Returns

A string with all instances of pattern replaced with replacement.

Examples

ExpressionResult
"abcde".regexReplace("b.", "QQ")"aQQde"
"abcde".regexReplace("B.", "QQ")"abcde"
"abcde".regexReplace("B.", "QQ", true)"aQQde"
"ab1cde".regexMatches("\d", "QQ")"abQQcde"

replace

Replaces all occurrences of a substring in a string.

Usage

<string>.replace(<substring>, <newString>)

Parameters

NameTypeRequiredDescription
substringstringYesThe substring to search for.
newStringstringYesThe string to replace all occurrences of the substring with

Returns

A string with all instances of the substring replaced with the value of newString.

Examples

ExpressionResult
"abcde".replace("abce", "xyz")"abcde"
"abcde".replace("abcd", "xyz")"xyze"
"abcde".replace("b", "x")"axcde"

Searching

contains

Checks if a substring exists within a string.

Usage

<string>.contains(<substring>)

Parameters

NameTypeRequiredDescription
substringstringYesThe substring to search for.

Returns

A value of true if the substring is found in the string.

Examples

ExpressionResult
"abcde".contains("bc")true
"abcde".contains("xy")false

indexOf

Searches a string for the first occurrence of a substring.

Usage

<string>.indexOf(<substring>)

Parameters

NameTypeRequiredDescription
substringstringYesThe substring to search for.

Returns

A number representing the position of the substring, or -1 if the substring isn't found.

Examples

ExpressionResult
"abcde".indexOf("bc")1
"abcde".indexOf("dee")-1

left

Gets the specified number of characters from the left side of a string.

Usage

<string>.left(<length>)

Parameters

NameTypeRequiredDescription
lengthnumberYesThe number of characters to get from the left side of the string.

Returns

A string with the specified number of characters from its left side. If length is 0, an empty string is returned.

Examples

ExpressionResult
"abcde".left(3)"abc"
"abcde".left(0)""

regexIsMatch

Checks if string matches a regular expression pattern.

Usage

<string>.regexIsMatch(<pattern>, <ignoreCase>)

Parameters

NameTypeRequiredDescription
patternstringYesA regular expression pattern.
ignoreCasebooleanNoIf true, the pattern will be case-insensitive. The default value is false.

Returns

A value of true if the string matches the provided pattern.

Examples

ExpressionResult
"abcde".regexIsMatch("bc")true
"abcde".regexIsMatch("Bc")false
"abcde".regexIsMatch("Bc", true)true
"a1bcde".regexIsMatch("\\d")true
"abcde".regexIsMatch("\\d")false

regexMatches

Searches a string for a regular expression and returns the matches.

Usage

<string>.regexMatches(<pattern>, <ignoreCase>)

Parameters

NameTypeRequiredDescription
patternstringYesA regular expression pattern.
ignoreCasebooleanNoIf true, the pattern will be case-insensitive. The default value is false.

Returns

An array of matches. Each match is an array of strings, which accounts for the fact that a single match may have multiple capture groups.

Examples

ExpressionResult
"abcde".regexMatches("b.")[["bc"],["be"]]
"ab123cdbe".regexMatches("\d(\d\d)")[["123","23"]]
"abcde".regexMatches("B.", true)[["bc"],["be"]]
"abcde".regexMatches("B.", true)[]

regexSearch

Uses a regular expression to find a substring within a string.

Usage

<string>.regexSearch(<pattern>, <ignoreCase>)

Parameters

NameTypeRequiredDescription
patternstringYesA regular expression pattern.
ignoreCasebooleanNoIf true, the pattern will be case-insensitive. The default value is false.

Returns

A number that represents the starting position of the matching substring, or -1 if a matching substring isn't found.

Examples

ExpressionResult
"abcde".regexSearch("bc")0
"abcde".regexSearch("Bc")-1
"abcde".regexSearch("Bc", true)0
"a1bcde".regexSearch("\\d")1
"abcde".regexSearch("\\d")-1

right

Gets the specified number of characters from the right side of a string.

Usage

<string>.right(<length>)

Parameters

NameTypeRequiredDescription
lengthnumberYesThe number of characters to get from the right side of the string.

Returns

A string with the specified number of characters from its right side. If length is 0, an empty string is returned.

Examples

ExpressionResult
"abcde".right(3)"cde"
"abcde".right(0)""

substr

Gets a substring from a string.

Usage

<string>.substr(<startIndex>, <length>)

Parameters

NameTypeRequiredDescription
startIndexnumberYesThe position of the beginning of the substring.
lengthnumberYesThe number of characters in the substring.

Returns

The substring that starts at startIndex and has a length of length.

An empty string is returned if:

  • The startIndex is equal to or greater than the length of the string
  • The value of length is 0

Examples

ExpressionResult
"abcde".substr(2, 2)"cd"
"abcde".substr(2, 0)""
"abcde".substr(5, 2)""

Splitting

regexSplit

Uses a regular expression to split a string into an array of strings.

Usage

<string>.regexSplit(<pattern>, <ignoreCase>)

Parameters

NameTypeRequiredDescription
patternstringYesA regular expression pattern.
ignoreCasebooleanNoIf true, the pattern will be case-insensitive. The default value is false.

Returns

An array of strings.

This array can contain empty values if:

  • A match is located at the beginning of the string
  • A match is located at the end of the string
  • There are two sequential matches

Examples

ExpressionResult
"abcde".regexSplit("bc")["", "de"]
"abcde".regexSplit("Bc")["abcde"]
"abcde".regexSplit("Bc", true)["a", "cde"]
"a1bcde".regexSplit("\\d")["a", "bcde"]
"abcde".regexSplit("\\d")["abcde"]

split

Splits a string into an array of strings.

Usage

<string>.split(<separator>)

Parameters

NameTypeRequiredDescription
separatorstringYesA delimiter for splitting the string.

Returns

An array of strings.

Examples

ExpressionResult
"abxcdxe".split("x")["ab", "cd", "e"]

Trimming

trim

Removes whitespace from the beginning and end of a string.

Usage

<string>.trim()

Returns

The string without trailing or leading whitespace.

Examples

ExpressionResult
" abc ".trimEnd()"abc"

trimEnd

Removes whitespace from the end of a string.

Usage

<string>.trimEnd()

Returns

The string without trailing whitespace.

Examples

ExpressionResult
" abc ".trimEnd()" abc"

trimStart

Removes whitespace from the beginning of a string.

Usage

<string>.trimStart()

Returns

The string without leading whitespace.

Examples

ExpressionResult
" abc ".trimStart()"abc "

Other

length

Calculates the number of characters in a string.

Usage

<string>.length()

Returns

The number of characters in the string.

Examples

ExpressionResult
"abcde".length()5
"".length()0