String Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > String commands > !Delimited Strings >

String Operations

GES. - Get-Extracted-String

Previous Top Next


MiniRobotLanguage (MRL)

 

GES. Command

Get Extracted String

 

 

Intention

 

Simply said: "Splits a string into two parts". More exact; you have text or string that consists of basically two parts. These parts are delimited by one or more  known delimiter-character(s). This is the situation where you should think of GES..

 

Returns the portion of a string - leading up to / or following - the first occurrence of a specified character or string. Let us see an easy example. We got a text and we want to have the first and the last name separated.

 

' We got this text

VAR.$$TXT=George,Wulf

 

' Here we get the first string before the delimiter

GES.b|$$TXT|,|$$FIR

 

' Here we get the next string after the delimiter

GES.d|$$TXT|,|$$LAS

 

' This is to display the result

MBX.Firstname is:$$FIR$crlf$Last name is:$$LAS

ENR.

 

And this is the result:

 

 

graphic

 

The modes of operation can be separated into two groups:

a,b,c,d - these work on whether a single split-string character,

               or on a split string of any length is given in P3.

e,f,g,h - these treat the split-string P3 as a group of single characters

             and test for each of them.

 

 

 

Syntax

 

GES.P1|P2[|P3][|P4]

 

 

Parameter Explanation

 

P1  - Prototype

 

Please use only one single prototype for this command.

a - get numeric result: position of last character before the split-string..

b - return the extracted string which is before the split-character..

c - get numeric result: position of next character after the split-string..

d - return the extracted string which is after the split-character.

e - get numeric result: position of last character before any of the chars

      in the split-string..

f - return the extracted string which is before any of the chars in the split-string.

g - get numeric result: position of next character after any of the chars in

     the split-string..

h - return the extracted string which is after any of the chars in the split-string.

 

 

Please use only one prototype for this command. The result can be in the original Variable P2 or if P4 is given, it will be placed in P4.

 

P2 - VAR for Source/Destination

P3 - VAR with Split-String or Character.

P4 - VAR forResult. If ommited Result is been placed in Source-Variable P2.

 

 

 

Example

 

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

' GES.-Demo

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

'DBM.2

'JNF.Move-Console.txt

: §§TXT=http://www.space web.com/links.htm

' When using 2 Parameters, the $sp$ is the default Split-Char

' Here we get anything till the first space

PRT. Before:>§§TXT<

GES.b|§§TXT

PRT. After :>§§TXT<

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

: §§TXT=http://www.space web.com/links.htm

' Now we us the / Sign as Split-char and after

PRT. Before:>§§TXT<

GES.b|§§TXT|/

PRT. After :>§§TXT<

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

: §§TXT=http://www.space web.com/links.htm

PRT. Before:>§§TXT<

GES.a|§§TXT|/|§§NUM

PRT. After :>§§TXT< -<§§NUM>

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

: §§TXT=http://www.space web.com/links.htm

PRT. Before:>§§TXT<

GES.c|§§TXT|$sp$|§§NUM

PRT. After :>§§TXT< -<§§NUM>

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

END.

 

 

 

 

Remarks

 

To split mutiple delimited strings, use SBD. or SBM.

 

 

 

Limitations:

 

-

 

 

See also:

 

    1.5.2 Working with Text-Strings

    VAR. - Variable Set Value/Clear

    IVS. / NVS. - If-Variable-String

    GSS. - GetSplitString

    SRT. - Sort Items

    ! STR. - String Command

    GES. - Get-Extracted-String

    SBD. - String between Delimiter

    SBM. - String between Delimiter-Multiple

    FEM. - For Each Member

    LEN. - Length-of-String