String Operations

<< Click to Display Table of Contents >>

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

String Operations

STR.INSERT

Previous Top Next


MiniRobotLanguage (MRL)

 

STR.INSERT

String commands

 

 

Intention

 

INSERT - Mode: This Mode will insert a String at a specified place into the Source String.

This command can change the length of a string.

 

Used on a large number of large strings, it will be slower then the STR.OVERWRITE command.

 

' Source and Target string

VAR.$$SRC=1234589

' String to insert

VAR.$$NEW=67

' Position where string will be inserted

VAR.$$POS=6

' This is where the magic happens

STR.INSERT|$$SRC|$$POS|$$NEW

' Here we get a message-box

MBX.$$SRC

ENR.

 

The result is:

 

graphic

 

To Replace bytes in a String, use the RPL. - RePLace in String command.

To extract a part out of a String, use the GSS. - GetSplitString command.

If your String is a delimited String (like a .csv-file), use:

 

    SBD. - String between Delimiter

    SBM. - String between Delimiter-Multiple

 

 

 

 

Syntax

 

STR.INSERT|P1|P2|P3

 

 

Parameter Explanation

 

P1 - source and destination variable

 

P2 - numeric parameter, will be completely resolved.

    Insert-Position is before the given byte-position.

    The inserted string will start at that position.

    If P2 is 1 or smaller then one, P3 will be appended

    before the start of the source-string. if P2 is larger

    then the length of the source-string, P3 will be appended

    to the end of the string.

 

P3 - INSERT-String. This string will be inserted into

    the source string.

 

 

 

 

Example

 

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

' STR.INSERT/FIND

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

VAR.$$SRC=1234589

VAR.$$FND=5

VAR.$$NEW=67

STR.FIND|$$SRC|1|$$FND

VAR.$$POS=$tos$

VIC.$$POS

STR.INSERT|$$SRC|$$POS|$$NEW

MBX.$$SRC

ENR.

 

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

' STR.INSERT

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

VAR.$$SRC=1234589

VAR.$$NEW=67

VAR.$$POS=6

STR.INSERT|$$SRC|$$POS|$$NEW

MBX.$$SRC

ENR.

 

 

 

Remarks

 

Variables inside the source P1 are only resolved once. Therefore it can be safely used for binary data. Specialfolders and systemvariables etc. are not resolved, to avoid unwanted changes in binary data.

 

 

 

Limitations:

 

-

 

 

See also:

 

    1.5.2 Working with Text-Strings

    VAR. - Variable Set Value/Clear

    VAS. - Variable with String

    RPL. - RePLace in String

    IVS. / NVS. - If-Variable-String

    GSS. - GetSplitString

    GES. - Get-Extracted-String

    GFS. - Get-Filtered-String

    SBD. - String between Delimiter

    SBM. - String between Delimiter-Multiple

    FEM. - For Each Member

    LEN. - Length-of-String