Skip to main content

Text functions

As parameters of the function, you can pass a regular string or a column name. To pass a regular string, it must be enclosed in double quotes, like "my string" or in apostrophes, like 'my string'. To pass a column cell, you can use the syntax ${columnName}.

Note that character and substring indexing in strings and lists starts at 0.

Function List:

Add(s1, s2)

Append the string s2 at the end of the string s1 and returns the result obtained.

Add("Police", "man")    // "Policeman"

Contains(s, sub)

Checks if the string s contains a match of sub.

Contains("Stormy Weather", "Sunny")      // false
Contains("Stormy Weather", "Weather") // true

EndsWith(s, postfix)

Checks if the string s ends with a match of postfix.

EndsWith("White Christmas", "White")        // false
EndsWith("White Christmas", "Christmas") // true

Eq(s1, s2)

Returns true if the string s1 equal to s2 and false otherwise.

Eq("Sky", "Sky")    // true

IsEmpty(s)

Returns true if the string s is empty or null, and false otherwise.

IsEmpty("")         // true
IsEmpty(null) // true
IsEmpty("Green") // false

IsNotEmpty(s)

Returns true if the string s is not empty and not null, and false otherwise.

IsNotEmpty("")         // false
IsNotEmpty(null) // false
IsNotEmpty("Green") // true

Length(s)

Returns the length of the string s.

Length("Text")    // 4

NotEq(x, y)

Returns false if the string s1 equal to s2 and true otherwise.

NotEq("Sky", "Sky")    // false

PadLeft(s, width, padding)

Pads the string s with the padding symbol on the left if s is shorter than width.

PadLeft("x", 3, "-")       // "--x"
PadLeft("123", 3, "-") // "123"

PadRight(s, width, padding)

Pads the string s with the padding symbol on the right if s is shorter than width.

PadRight("x", 3, "-")       // "x--"
PadRight("123", 3, "-") // "123"

ParseFloat(s)

Parse s as a, possibly signed, real literal and return its value.

ParseFloat("2025")      // -2025
ParseFloat("-012.78") // -12.78

ParseInt(s)

Parse s as a, possibly signed, integer literal and return its value.

ParseInt("2025")    // 2025
ParseInt("-012") // -12

RegExpContains(s, pattern)

Checks if the string s contains a string matches a regular expression pattern.

RegExpContains("Stormy Weather", "Sunny")      // false
RegExpContains("name@gmail.com", "(\W|^)[\w.\-]{0,25}@(hotmail|gmail)\.com(\W|$)") // true

RegExpExtract(s, pattern, n)

Returns the n-th part of a string s that matches a regular expression pattern.

RegExpExtract("Hello World!", "l+", 0)    // "ll"
RegExpExtract("Hello World!", "l+", 1) // "l"

RegExpReplace(s, pattern, sub)

Returns the string after replacing a substring sub in string s according to a regular expression pattern.

RegExpReplace("Hello World!", "l+", "LL")    // "HeLLo WorLLd!"

ReplaceAll(s, from, replace)

Replaces all substrings in string s that match from with replace and returns the result obtained.

ReplaceAll("New York", "York", "Orleans")    // "New Orleans"
ReplaceAll("Every", "", ".") // ".E.v.e.r.y."
ReplaceAll("moto", "o", "") // "mt"

SplitString(s, separator, i)

Splits the string s at matches of separator and returns the i-th of the substring between the matches.

SplitString("Born to Be Wild", " ", 2)     // "Be"
SplitString("Born to Be Wild", "to", 1) // " Be Wild"
SplitString("a,b,c,d", ",", 0) // "a"

StartsWith(s, prefix)

Checks if the string s starts with a match of prefix.

StartsWith("White Christmas", "White")        // true
StartsWith("White Christmas", "Christmas") // false

StrFind(s, sub)

Returns the index of the first occurrence of the string sub in the string s.

If sub or s are empty then the function returns -1.

StrFind("Hello world!", "Hello")  // 0
StrFind("Hello world!", "world") // 6
StrFind("Hello world!", "Car") // -1
StrFind("", "Moon") // -1

StrLeft(s, count)

Returns the first count characters of the string s.

If s is empty then the function returns empty string.

count is of type integer. If count is negative, then the count number of characters will be removed from the right-hand side of the s string.

StrLeft("Daddy", 1)      // "D"
StrLeft("Daddy", 10)) // "Daddy"
StrLeft("", 3) // ""
StrLeft("Daddy", -3) // "Da"
StrLeft("Daddy", -8)) // ""

StrRight(s, count)

Returns the last count characters of the string s.

If s is empty then the function returns empty string.

count is of type integer. If count is negative, then the count number of characters will be removed from the left-hand side of the s string.

StrRight("Daddy", 1)      // "y"
StrRight("Daddy", 10)) // "Daddy"
StrRight("", 3) // ""
StrRight("Daddy", -3) // "dy"
StrRight("Daddy", -8)) // ""

StrRepeat(s, n)

Returns a string consisting of n repetitions of string s.

StrRepeat("Chain", 2)    // "ChainChain"

Substring(s, start, end)

Returns the substring of the string s from start index, inclusive, to end, exclusive.

Substring("Alfa Romeo", 5, 10)    // "Romeo"

ToLowerCase(s)

Converts all characters in this string s to lower case and returns the result obtained.

ToLowerCase("ALPHABET")    // "alphabet"

ToUpperCase(s)

Converts all characters in this string s to upper case and returns the result obtained.

ToUpperCase("alphabet")    // "ALPHABET"

Trim(s)

Returns the string without any leading and trailing whitespace of the string s.

Trim("  My home.   ")    // "My home."