strsplit(X;Y;I)

Returns the character at a particular position, or the substring delimited by a particular value, within a given string.

Syntax

strsplit(X;Y;I)
bstrsplit(X;Y;I)

Input

Argument Type Description
X text The string on which to apply the function

A scalar value or the name of a column

Y text Y is the character or string to be used as the delimiter in X

A scalar value or the name of a column

I integer An index corresponding to the particular character or substring in X

The index I is 1-based (i.e., the first occurrence has index 1).

A negative index counts back from the end of the string (i.e., I=-1 refers to the last element or character).

Return Value

If Y is non-empty, this function splits the string X using Y as a delimiter and returns the text value corresponding to the I'th delimited element. If Y is empty, it returns the I'th character of X.

If X or I is N/A, the result is N/A. If Y is N/A, the result is the I'th character of X.

Sample Usage

value delimiter index strsplit(value;delimiter;index)
'apple,banana,cherimoya' ',' 2 'banana'
'foo--bar--baz' '--' -1 'baz'
'foo--bar--baz' '' -3 'b'

Additional Information

  • strsplit is Unicode (UTF-8) compliant and will work with Unicode or plain ASCII text fields.
  • If passed a string argument that is not legal Unicode, it will by default signal an error (configurable as a user preference).
  • A corresponding function bstrsplit can be used with non-Unicode strings (e.g., binary or legacy encodings).