PARSE

Syntax

PARSE (string_expression, token_number, delimiter)

Description

Returns the specified token from a string, where a token is a portion of the string separated by a specified delimiter.

Arguments

string_expression The string from which to return a token, that is, a part of the string separated by a specified delimiter; for example, the second set of digits in a phone number, where dashes separate each set of digits.
token_number The occurrence of the string element to return, beginning with 1.
delimiter One or more characters that separate each token, allowing the tokens to be identified.

Returns

The String token, or portion of the original string_expression.

Remarks

If no delimiters are found and token_number = 1, PARSE returns the entire string. If token_number is any other value, PARSE returns NULL.

If token_number is greater than the number of tokens in the string_expression, PARSE returns NULL.

Examples

If MyEntity.LicensesHeld contains the value "NH, MA, VT, NY"

The following formula:

PARSE(MyEntity.LicensesHeld, 2, ",")

Returns: MA

The following formula:

PARSE(MyEntity.LicensesHeld, 4, ",")

Returns: NY

Related Topics

Text Functions

PARSENAME

PARSEADDR