Skip to main content

SPLIT

Returns a substring from a string, using a delimiter character to divide the string into a sequence of tokens.

Syntax

SPLIT ( string_expression, deliminator, token_number ) 

Arguments

string_expression
A valid string expression.

deliminator The substring used to divide the string_expression.

token_number The instance of the divided tokens to return. When the token number is positive, tokens are counted starting from the left end of the string; when the token number is negative, tokens are counted starting from the right.

Return Type

Returns a STRING.

Examples

Examples in this section use the example blockchain.

The following example splits each value in str at each instance of "e" and returns the first instance.

SELECT SPLIT(str, "e", 1) FROM example;

Response:

SELECT SPLIT(str, "e", 1) [STRING]
NULL
NULL
l
dial