strsplitpos(X;Y;I)
Returns the position of a certain element delimited by a particular value within a given string.
Syntax
strsplitpos(X;Y;I)
bstrsplitpos(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 A negative index counts back from the end of the
string (i.e., |
Return Value
This function splits the string X
using Y
as a delimiter
and returns an integer value corresponding to the position in X
of the
I
'th delimited element.
If X
, Y
, or I
is N/A, the result is
N/A.
Sample Usage
value |
delimiter |
index |
strsplitpos(value;delimiter;index) |
---|---|---|---|
'apple,banana,cherimoya' | ',' | 2 | 7 |
'foo--bar--baz' | '--' | -1 | 11 |
Additional Information
strsplitpos
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
bstrsplitpos
can be used with non-Unicode strings (e.g., binary or legacy encodings).