How do I parse a string?

Article:HOWTO6991  |  Created: 2005-10-25  |  Updated: 2005-10-25  |  Article URL http://www.symantec.com/docs/HOWTO6991
Article Type
How To



Question

How do I parse a string?

Answer

The "Source" value is the string you want to parse. (If you are using a variable, it must be encased by % signs.) For example, %VARIABLE% or the actual string such as "This is a test." We will use this string throughout the article to demonstrate the "Parse String" action.

The Pattern/Position is the character or the position of the character that you want to parse. Example using, "This is a test.": If the Pattern is a, a would be removed from the destination variables. If the Position is 8, the statement would parse at 8 from the left to parse, which would be before the a value. (The Position number includes spaces.)

The Destination Variable 1 is the variable that holds the string before the Pattern/Position. Example using, "This is a test.": If the Pattern is a, Destination Variable 1 would hold "This is ". If the Position is 8, the Destination Variable 1 would hold "This is ".

The Destination Variable 2 is the variable that holds the string after the Pattern/Position. Example using, "This is a test.": If the Pattern is a, the Destination Variable 2 would hold " test." If the Position is 8, the Destination Variable 2 would hold "a test."

There are four operations to select from. The first two operations are used to parse out a character or string. The second two operations are used to parse out a certain position (this must be a number).

Trim Spaces checkbox will trim extra spaces that are left resulting the parse action. For example: If the Pattern is a, Destination Variable 1 would hold "This is" and Destination Variable 2 would hold "test." If the Position is 8, Destination Variable 1 would hold "This is" and Destination Variable 2 would hold "a test."

Ignore Case will make the Pattern non-case specific if checked.


Legacy ID



3366


Article URL http://www.symantec.com/docs/HOWTO6991


Terms of use for this information are found in Legal Notices