dropto(X;Y)

Returns the remaining part of a given string after the characters up to and including the first occurrence of a particular substring are dropped.

Syntax

dropto(X;Y)

Input

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

A column name

Y text A substring in X that defines the point after which the resultant string begins

Return Value

Returns the text string in X that follows the first occurrence of the string Y. In other words, the characters up to and including the first occurrence of Y are dropped, and the remaining string is returned.

If X is N/A, the result is N/A. If there is no occurrence of Y in X, the result is N/A.

Sample Usage

value instance dropto(value;instance)
'ana@aol.com' '@' 'aol.com'

Example

In the "ZIP to CBSA Mapping" table (pub.geo.cbsa), the values in the cbsa_name column consist of strings of the form "city, state". You can drop the text up to and including the ", " to obtain just the name of the state. To do this, create a computed column and apply the dropto(X;Y) function to the cbsa_name column, specifying the string ", " as the Y parameter.

<base table="pub.geo.cbsa"/>
<willbe name="example" value="dropto(cbsa_name;', ')"/>
<colord cols="cbsa_name,example"/>

For those values that do not have this "city, state" structure, an N/A is returned.

Additional Information

  • This function does not work with Unicode (UTF-8) strings.
  • For Unicode-compliant alternatives, consider:
    • strdrop(X;Y;N)
    • strtrim(X;Y;C;D)
    • strfind(X;Y;I)
    • strextract(X;P;N)