STRING_TO_ARRAY

This function splits a given string by a given separator and returns the result in an array of strings.

Syntax

STRING_TO_ARRAY(<string>, <delimiter>)

Parameters

Parameter Description
<string> The string to split.
<delimiter> The separator to split the string by.

Return Types

ARRAY(TEXT)

Example

The following example splits the nicknames of players into separate items in an array:

SELECT
	STRING_TO_ARRAY('stephen70|esimpson|ruthgill|', '|') AS nicknames;

Returns: ["stephen70","esimpson","ruthgill",""]