A newer version of this documentation is available.

View Latest

String functions

String functions perform operations on a string input value and returns a string or other value.

CONTAINS(expression, substring)

True if the string contains the substring.

INITCAP(expression), TITLE(expression)

Converts the string so that the first letter of each word is uppercase and every other letter is lowercase.

LENGTH(expression)

Returns length of the string value.

LOWER(expression)

Returns lowercase of the string value.

LTRIM(expression [, characters ])

Returns string with all leading chars removed. White space by default.

POSITION(expression, substring)

Returns the first position of the substring within the string, or -1. The position is zero-based, i.e., the first position is 0.

REPEAT(expression, n)

Returns string formed by repeating expression n times.

REPLACE(expression, substring, repl [, n ])

Returns string with all occurrences of substr replaced with repl. If n is given, at most n replacements are performed.

RTRIM(expression, [, characters ])

Returns string with all trailing chars removed (white space by default).

SPLIT(expression [, sep ])

Splits the string into an array of substrings separated by sep. If sep is not given, any combination of white space characters is used.

SUBSTR(expression, position [, length ])

Returns substring from the integer position of the given length, or to the end of the string. The position is zero-based, i.e. the first position is 0. If position is negative, it is counted from the end of the string; -1 is the last position in the string.

TITLE(expression), INITCAP(expression)

Converts the string so that the first letter of each word is uppercase and every other letter is lowercase.

TRIM(expression [, characters ])

Returns string with all leading and trailing chars removed. White space by default.

UPPER(expression)

Returns uppercase of the string value.

Example

The following example shows the use of a LOWER string function.

    SELECT product
     FROM product
       UNNEST product.categories as categories
       WHERE LOWER(categories) = "appliances"