String Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > String commands >

String Operations

ACH. - After CHaracter

Previous Top Next


MiniRobotLanguage (MRL)

 

ACH. Command

After Character

 

 

Intention

 

Split a file-path or string (text) at any character. Return the Part after the specified character. You can specify a character/string and optional an index number.

The Index Number is used to count all occurrences of that character and select the specified character. If you have a string:

 

http://www.fa2.de/index.html

 

You can do several things using ACH. For example:

 

ACH.$$TXT|.

' Result on TOS will be: "de/index.html"

 

You can specify more parameters and do this:

 

ACH.$$TXT|/|3

' Result on TOS will be: "index.html"

 

You can use it to get the extension of a filename:

 

$$FIL=C:\Folder\MyFile.txt

ACH.$$FIL|.||$$RET

DBP.$$RET

 

 

 

Syntax

 

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

 

 

 

Parameter Explanation

 

P1  - Variable with string to split

 

P2 - Character or string to split variable at.

    Can not be the "|" (Pipe Symbol).

 

P3 - (optional) Index number of the element that defines the

    splitting point. If the number is negative (-1,-5 etc.) then

    the elements are counted from right to left (in reverse order).

 

P4 - (optional) Variable for Result, if omitted TOS is used.

 

 

 

Example

 

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

' Sample: ACH

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

'

$$FIL=C:\Folder\MyFile.txt

ACH.$$FIL|.||$$RET

DBP.$$RET

 

$$TES=Hallo.txt

ACH.$$TES|.||$$RES

DBP.$$RES

 

$$TES=Hallo.txt

BCH.$$TES|.||$$RES

DBP.$$RES

 

 

 

Remarks

 

-

 

 

Limitations:

 

-

 

 

See also:

 

  BCH. - Before Character

  ALB. - After last Backslah

  BLB - Before last Backslash

  GFT. - Get-File-Token

  GSS. - GetSplitString

  VRT. - Variable-Right-Trim

  ! STR. - String Command