strdrop(X;Y;N)

Returns all but the first number of characters, or the substring consisting of all but the first number of elements delimited by a particular value, within a given string.

Syntax

strdrop(X;Y;N)
bstrdrop(X;Y;N)

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

N integer An index corresponding to the number of elements to take from X

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

A negative index counts back from the end of the string (i.e., N=-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 a text value corresponding to the Y-delimited list of all but the first N elements. If Y is empty, it returns all but the first N characters of X.

If X or N is N/A, the result is N/A. If Y is N/A, the result is all but the first N characters of X.

Sample Usage

value delimiter index strdrop(value;delimiter;index)
'apple,banana,cherimoya' ',' 1 'banana,cherimoya'
'foo--bar--baz' '--' -1 'foo--bar'
'foo--bar--baz' '' 4 '-bar--baz'

Additional Information

  • strdrop 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 bstrdrop can be used with non-Unicode strings (e.g., binary or legacy encodings).