- If the delimiter is an empty string
'', the result is an array containing the entire original input string as a single element. - If the delimiter is
NULL, the string is split into individual characters, with one character per array element.
Syntax
Parameters
| Parameter | Description |
|---|---|
<string> | The string to split. |
<delimiter> | The separator to split the string by. |
Return Types
ARRAY(TEXT)
Examples
Example The following code example splits the stringstephen70|esimpson|ruthgill| at each | character and returns the resulting array as nicknames:
| nicknames (ARRAY(TEXT)) |
|---|
STRING_TO_ARRAY with an empty delimiter, producing an array containing a single element which contains the input text:
| size_one_array (ARRAY(TEXT)) |
|---|
STRING_TO_ARRAY with NULL as the delimiter, splitting the text into individual characters:
| single_characters (ARRAY(TEXT)) |
|---|