&PARSE( &string[value])
&parse( &string[value]) &Parse( &string[value])
&String | Variable with a string value. |
Value | Can be:
|
If &STR is assigned by the statement % &STR = " X, PARM = `A, B', Y", then
This statement... | Is equivalent to... |
---|---|
% PART = &PARSE( &STR, ",") | % &STR = "PARM = `A, B', Y"
% &PART = "X" |
If &PARSE is used again on &STR:
This statement... | Is equivalent to... |
---|---|
% &PART = &PARSE( &STR, ",") | % &STR = "Y"
% &PART = "PARM = `A, B'" |
Note that the comma embedded in `A, B' is ignored.
If &PARSE is used again on &STR:
This statement... | Is equivalent to... |
---|---|
% &PART = &PARSE( &STR, ",") | % &STR = ""
% &PART = "Y" |
And finally, if &PARSE is used again on &STR:
This statement... | Is equivalent to... |
---|---|
% &PART = &PARSE( &STR, ",") | % &STR = ""
% &PART = "" |
In other words, after processing, you get the following result.
% &PART = &PARSE( &STR, ",")
Where
IF &STR is assigned by the statement % &STR = " ABC ":
This statement... | Is equivalent to... |
---|---|
% &PART = &PARSE( &STR) | % &STR = ""
% &PART = "ABC" |
Because the argument is restored before the &PARSE value is passed, &PARSE eliminates spaces and returns the string to the original variable.
If % &STR = " ABC ":
This statement... | Is equivalent to... |
---|---|
% &STR = &PARSE( &STR) | % &STR = "ABC" |
Comments: