<< Click to Display Table of Contents >> Navigation: 3. Script Language > String commands > !STR.- String Command > String Operations |
MiniRobotLanguage (MRL)
STR.ExtractAny
Extract Substring Up to Any Specified Character
Intention
This command is used to extract a substring from a main string, starting from an optional position and up to the first occurrence of any character specified in a list.
This is particularly useful for parsing strings containing arguments or delimited strings.
•The command is case-sensitive.
•If P3 is zero, or beyond the length of P1, a null string is returned.
•If P3 is negative, the starting position is counted from right to left.
•If P2 is not present in P1, or either string parameter is null, all of P1 is returned.
Syntax
STR.ExtractAny|P1|P2|P3[|P4]
STR.Exa|P1|P2|P3[|P4]
Parameter Explanation
•P1 - Source string from which to extract.
•P2 - Characters to search for (ANY option).
•P3 - Optional starting position in the source string.
•P4 - Optional variable for result (if omitted, result is placed in P1).
Example
'***********************************
' STR.-Sample
'***********************************
$$SRC=<Hello, World!>
$$SEA=,!
$$STA=1
STR.ExtractAny|$$SRC|$$SEA|$$STA|$$RES
' $$RES will contain "Hello"
ENR.
Remarks
-
Limitations:
-
See also:
•