String Operations

<< Click to Display Table of Contents >>

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

String Operations

BLO.BlockGetAll

Previous Top Next


MiniRobotLanguage (MRL)

 

BLO.BlockGetAll

Gets all top-level blocks into an ARR array.

 

clip1138

 

Intention

 

This command scans a source string and finds all complete, top-level blocks. It populates a specified ARR array with the results.

Each element in the destination array will contain one full block, including its start and end delimiters. The total number of blocks found is returned on the Top of Stack (TOS).

 

Visual Example

 

Getting All Top-Level Blocks (including delimiters)

 

               ┌─ Block 1 ─┐ ┌─ Block 2 ─┐ ┌─ Block 3 ─┐ ┌─ Block 4 ─┐ ┌─ Block 5 ─┐

Source String:    {A} B        {C} D           {E} F         {G[H]I} J      {K}

               └───┬───────┘ └───┬───────┘ └───┬───────┘ └───┬───────┘ └───┬───────┘

                   │             │             │             │             │

                   ▼             ▼             ▼             ▼             ▼

Result Array:    [ "{A}",       "{C}",        "{E}",       "{G[H]I}",     "{K}" ]

 

 

Syntax

 

BLO.GetAll|P1|P2|P3|P4

 

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 number of the destination ARR array to populate.

 

Example

 

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

' BLO.BlockGetAll Example

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

$$SRC=[ITEM]Apple[END] [ITEM]Orange[END]

BLO.BlockGetAll|$$SRC|[ITEM]|[END]|5

' ARR array #5 now contains 2 elements:

' Index 0: "[ITEM]Apple[END]"

' Index 1: "[ITEM]Orange[END]"

ARR.Show|5

MBX.!

ENR.

 

 

See also:

 

BLO.BlockGetAllContent - Gets all block contents into an ARR array