Text functions
Several functions are available to help you process text strings.
Text pattern matching functions
You can use contains, startsWith, and endsWith to check for patterns within text strings. All three share the same syntax, contains(text, substring) and return either TRUE or FALSE. Regexp is not supported. These operations are case-insensitive.
Example usages are provided below:
| Formula | Result | |
|---|---|---|
startsWith("foobar", "foo") | TRUE | |
startsWith("foobar", "") | TRUE | |
startsWith("foobar", toDateTime(" 2023-13-01 10:45:49")) | undefined (because toDateTime(" 2023-13-01 10:45:49") is undefined and undefined values are contagious and propagate through the formula) | |
endsWith("foobar", "bar") | TRUE | |
contains("foobar", "bar") | TRUE | |
contains("foobar", "BAR") | TRUE (because comparisons are case-insensitive) | |
contains("bar", "foobar") | FALSE |
Concatenation function
The function concat lets you concatenate all arguments without separators. It expects strings or vectors of strings as arguments, and it will return a string.
Example usages are provided below:
| Formula | Result |
|---|---|
concat("foobar", "bar") | "foobarbar" |
concat("foobar") | "foobar" |
concat("foobar",0) | "foobar0" |
concat(23) | "23" |
concat(FALSE) | "0" |
concat(23.2323) | "23.2323" |
concat(23,"133") | "23133" |
concat([23,"133"],undefined,"XX",FALSE) | undefined (because undefined values are contagious and propagate through the formula) |
concat(23,[[23,"133"],undefined,"XX",FALSE],undefined,"XX",FALSE) | undefined (because undefined values are contagious and propagate through the formula) |
concat(23,2) | "232" |
concat(55,undefined,"hello") | undefined (because undefined values are contagious and propagate through the formula) |
Not yet implemented: Case conversion functions
The functions toUpperCase and toLowerCase convert the input string to upper case and lower case, respectively. Both functions expect a string as an argument and return a string.
Example usages are provided below:
| Formula | Result |
|---|---|
toUpperCase("foobar") | "FOOBAR" |
toLowerCase("FOOBAR") | "foobar" |
toUpperCase(23) | "23" |
toLowerCase(23.2323) | "23.2323" |
toUpperCase(TRUE) | "1" |
toUpperCase(23,"133") | "23" because toUpperCase only takes the first argument and ignores the rest |
toLowerCase(23,"133") | "23" because toLowerCase only takes the first argument and ignores the rest |
toUpperCase([23,"133"],undefined,"XX",FALSE) | "23" because the second, third, and fourth arguments are ignored and because only the first element of the vector is considered |