String Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > String commands > !BLO.-Block-Commands > Block Extraction >

String Operations

BLO.BlockGetNthEx

Previous Top Next


MiniRobotLanguage (MRL)

 

BLO.BlockGetNthEx

Gets Nth block with extended info (pos, status).

 

Intention

 

This command performs the same core function as BLO.BlockGetNth, but provides detailed feedback about the operation.

In addition to the Nth block itself, it returns its content, starting position, and a status code indicating success or if the requested block was not found.

 

                      Finding the 2nd Top-Level Block

 

                 Block 1                 Block 2

                ┌──────────────┐   ┌──────────────┐

Source String:  <MSG>Hello</MSG>   <MSG>World</MSG>  <MSG>Again</MSG>

                                   ▲              ▲

                                   │              │

N=2 finds this block:   -----------┘              └----------

 

Result: "<MSG>World</MSG>"

 

 

Syntax

 

BLO.BlockGetNthEx|P1|P2|P3|P4|P5[|P6][|P7][|P8]

 

Parameter Explanation

 

P1 - (Input, Text) The source string to search within.

P2 - (Input, Text) The starting delimiter string.

P3 - (Input, Text) The ending delimiter string.

P4 - (Input, Numeric) The 1-based index of the block to retrieve.

P5 - (Output, Text) Variable to store the full block string.

P6 - (Output, Text) Optional. Variable to store the content *inside* the block.

P7 - (Output, Numeric) Optional. Variable to store the block's 1-based start position.

P8 - (Output, Numeric) Optional. Variable to store the numeric status code.

 

Example

 

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

' BLO.BlockGetNthEx Example

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

$$SRC=[A]1[Z] [A]2[Z] [A]3[Z]

BLO.BlockGetNthEx|$$SRC|[A]|[Z]|3|$$FUL|$$CON|$$POS|$$STA

PRT. FUL= $$FUL

PRT.Expected:"[A]3[Z]"

PRT. CON= $$CON

PRT.Expected 3

PRT. POS= $$POS

PRT. Expected 17

PRT.STA=$$STA

PRT. Expected: 0

MBX.Found content: $$CON

ENR.

 

See also:

 

BLO.BlockGetNth - Gets the Nth top-level block

BLO.BlockGetFirstEx - Gets first block with extended info