String Operations

<< Click to Display Table of Contents >>

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

String Operations

BLO.BlockGetLastEx

Previous Top Next


MiniRobotLanguage (MRL)

 

BLO.BlockGetLastEx

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

 

clip1143

    Test-Results.

 

Intention

 

This command performs the same core function as BLO.BlockGetLast, but provides extended metadata about the final block in the string.

It returns the block's content, precise position, and diagnostic status codes to handle edge cases like unclosed structures or delimiter conflicts.

 

 

Syntax

 

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

 

Parameter Explanation

 

P1 - (Input, Text) Source string containing blocks to analyze

P2 - (Input, Text) Opening delimiter pattern

P3 - (Input, Text) Closing delimiter pattern

P4 - (Output, Text) Variable storing complete block text [including delimiters]

P5 - (Output, Text) Optional. Inner content between delimiters

P6 - (Output, Numeric) 1-based starting position of block in source string

P7 - (Output, Numeric) Status code:
0 Success
1 No blocks found
2 Unclosed block at EOF
3 Invalid delimiters

 

Example

                   Processing Multiple Blocks in Reverse Order

 

                   Source String: [ITEM] First Block [/ITEM][ITEM] Second Block With [ITEM]Nested[/ITEM][/ITEM]

                                                               └── Finds the final [ITEM][/ITEM] pair, ignoring properly nested structures

 

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

' BLO.BlockGetLastEx Demonstration

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

$$ITE=[ITEM]

$$END=[/ITEM]

$$DAT=This contains [ITEM]multiple[/ITEM] nested [ITEM]levels[/ITEM] and escaped [[[ITEM]]]

BLO.BlockGetLastEx|$$DAT|$$ITE|$$END|$$FIN|$$INN|$$POS|$$STA

PRT. Expected Results:' 

PRT. Original-Text: $$DAT

PRT. Complete Block:$$FIN

PRT. Inner Content: $$INN

PRT. Position: $$POS

PRT. Status: $$STA

PRT.---------------------------------------------------

MBX.!

ENR.

 

Remarks

 

 

Processes blocks in reverse order for accurate detection of final structures

 

See also:

 

BLO.BlockGetLast - Basic last block retrieval

BLO.BlockGetNthEx - Indexed block access