String Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > String commands >

String Operations

CSP. - Clip String Parts

Previous Top Next


MiniRobotLanguage (MRL)

 

CSP. Command

Clip String Part

 

 

Intention

 

Returns a part of a string/text with Text at letf and(or right side removed.

If you have a text/string and you want to clip some letters from left or right side, think of CSP. Usage is easy:

 

VAR.$$TXT=Hello name is Peter, Tel.12345

' Now we are going to Clip some letters from Left side

' We put the result in $$RES

CSP.5|$$TXT|$$RES

DBP.$$RES

' The result is "name is Peter, Tel.12345"

 

 

' We will now clip 5 characters from the right side

' and put the result into the same variable as the Source

VAR.$$TXT=Hello name is Peter, Tel.12345

CSP.,5|$$TXT

DBP.$$TXT

' The result is "llo name is Peter, Tel."

 

 

' We can also clip text at both sides at the same time

VAR.$$TXT=Hello name is Peter, Tel.12345

CSP.3,8|$$TXT|$$RES

DBP.$$RES

' The result is: "lo name is Peter, T"

 

 

 

 

Syntax

 

CSP.P1|P2[|P3]

 

 

Parameter Explanation

 

P1 - Clip-Position(s), Format:

(number of characters to clip from left side),(number of characters to clip from right side)

 

P2  - Input variable, variable with Source-String, if P3 is missing, this variable will also be

       used as Target variable.

 

P3  - (optional) Target-Variable, receives the result.

 

 

 

Example

 

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

' CSP.-Sample

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

VAR.$$TXT=Hello name is Peter, Tel.12345

' Now we are going to Clip some letters from Left side

' We put the result in $$RES

CSP.5|$$TXT|$$RES

DBP.$$RES

 

' We will now clip 5 characters from the right side

' and put the result into the same variable as the Source

VAR.$$TXT=Hello name is Peter, Tel.12345

CSP.,5|$$TXT

DBP.$$TXT

 

' We can also clip text at both sides at the same time

VAR.$$TXT=Hello name is Peter, Tel.12345

CSP.3,8|$$TXT|$$RES

DBP.$$RES

'

ENR.

 

 

 

Remarks

 

Binary compatible variable resolution is used for the Source-Part.

 

 

 

Limitations:

 

-

 

 

 

See also:

 

    1.5.2 Working with Text-Strings

    GSS. - GetSplitString

    VAR. - Variable Set Value/Clear

    IVS. / NVS. - If-Variable-String

    GSS. - GetSplitString

    ACH. - After Character

    BCH. - Before Character

    ! STR. - String Command

    GES. - Get-Extracted-String

    SBD. - String between Delimiter

    SBM. - String between Delimiter-Multiple

    FEM. - For Each Member

    LEN. - Length-of-String

    ! STR. - String Command