SPLIT_BY_STRING
Descriptionβ
Split the input string into a string array according to the specified string.
Syntaxβ
SPLIT_BY_STRING ( <str>, <separator> )
Parametersβ
Parameter | Description |
---|---|
<str> | The string to be split. |
<separator> | The string used for splitting. |
Return Valueβ
Returns a string array split according to the specified string. Special cases:
- If any of the parameters is NULL, NULL is returned.
- When
<separator>
is an empty string,<str>
will be split to byte sequence.
Examplesβ
SELECT split_by_string('hello','l');
+-------------------------------+
| split_by_string('hello', 'l') |
+-------------------------------+
| ["he", "", "o"] |
+-------------------------------+
SELECT split_by_string('hello','');
+------------------------------+
| split_by_string('hello', '') |
+------------------------------+
| ["h", "e", "l", "l", "o"] |
+------------------------------+