String Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > String commands > !STR.- String Command > Split String Commands >

String Operations

STR.Extract

Previous Top Next


MiniRobotLanguage (MRL)

 

STR.Extract

Extract Substring Up to a Specified Character or String

 

clip0845

 

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 a specified string.

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.Extract|P1|P2|P3[|P4]

STR.Ext|P1|P2|P3[|P4]

 

 

 

Parameter Explanation

 

�P1 - Source string from which to extract.

�P2 - String to search for.

�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=World

$$STA=1

STR.Extract|$$SRC|$$SEA|$$STA|$$RES
' $$RES will contain "Hello, "

ENR.

 

 

 

 

 

Remarks

 

-

 

 

Limitations:

 

-

 

 

See also:

 

? � �

 

 

 

�

See also:

 

? STR.StrBetween - Extract between delimiters

? STR.GrabBetween - Advanced extraction

? STR.ExtractAny - Extract until any char