Template

<< Click to Display Table of Contents >>

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

Template

STR.GrabBetween

Previous Top Next


MiniRobotLanguage (MRL)

 

STR.GrabBetween

Extracts a Substring Between Delimiters at a Specific Nesting Level

 

 

Intention

 

This command extracts a substring from a source string (P1) that is enclosed between a specified starting delimiter (P2) and ending delimiter (P3) at a given nesting level (P4).

The result is either placed on the Top of Stack (TOS) or in an optional variable (P5).

 

 

 

 

Syntax

 

 

STR.Grab Between|P1|P2|P3[|P4][|P5]

 

 

Parameter Explanation

 

P1 - (Source String) The string from which to extract the substring.

P2 - (Starting Delimiter) The character or string that marks the beginning of the substring to extract.

P3 - (Ending Delimiter) The character or string that marks the end of the substring to extract.

P4 - (Nesting Level) The level of nesting to consider when extracting the substring.

P5 - (Optional) Variable for storing the result. If omitted, the result is placed on TOS.

 

 

 

 

Example

 
'***********************************

' STR.-Sample

'***********************************

' We have 3 nesting Level with one word at each level

$$SRC=(Hello(World(new)))

$$STA=(

$$ENA=)

$$LVA=1

STR.GrabBetween|$$SRC|$$STA|$$ENA|$$LVA|$$REA

$$LVA=2

STR.GrabBetween|$$SRC|$$STA|$$ENA|$$LVA|$$REB

$$LVA=3

STR.GrabBetween|$$SRC|$$STA|$$ENA|$$LVA|$$REC

MBX.$$REA $$REC $$REB

' Returns "Hello new World"

ENR.

 

 

 

 

 

 

Remarks

 

-

 

 

Limitations:

 

-

 

 

See also:

 

    1.6.1. Program Flow Control

    ! Smart Package Robot 's Parallel Robot Operations

    1.5. Features and Hints