PARSE |
|
| Top Previous Next | |
Syntax:
PARSE <field list>, <string>
Description:
The PARSE command provides a way to parse the output of DialogScript functions that return multiple values (such as @FILE and @MOUSEPOS) into separate variables. It can also be used to parse a line containing several fields in a data record into separate variables.
The <field list> parameter consists of a semicolon-separated list of DialogScript variables or, if a dialog is showing, dialog element names, which are to receive the data. The <string> is a variable containing the data to be parsed, consisting of the data fields separated by the current field separator character. By default this character is a vertical bar: '|'. This can be changed using the command OPTION FIELDSEP.
The <field list> parameter must be enclosed in quotes, in order to prevent the DialogScript interpreter from replacing variable names contained in the parameter by their contents.
When PARSE is used with user-provided data, note that data fields contained in <string> must be enclosed in quotes if it is possible for them to contain the field separator character. Instances of the field separator character found within quotes will be treated as part of the data, and not as a field separator. The enclosing quotes will also be removed.
So for example, if the field separator is '|' and variable %D contains "Fred Jones"|"2, Main Street", the command:
PARSE "%A;%B",%D
would set %A to Fred Jones (note the absence of quotes) and %B to 2, Main Street.
OK:
Unchanged.
Example:
%Y = @next(1)
PARSE "%N;%A;%B;EDIT1", %Y
See also: