<< Click to Display Table of Contents >> Navigation: 3. Script Language > String commands > String Operations |
MiniRobotLanguage (MRL)
BCH. Command
Before Character
Intention
Split a file-path or string (text) at any character. Return the Part before 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 BCH. For example:
BCH.$$TXT|.
' Result on TOS will be: "http://www.fa2"
You can specify more parameters and do this:
BCH.$$TXT|/|3
' Result on TOS will be: "http://www.fa2.de"
You can use it to get all but the extension of a filename:
$$FIL=C:\Folder\MyFile.txt
BCH.$$FIL|.||$$RET
DBP.$$RET
Syntax
BCH.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: BCH
'***********************************************
'
$$FIL=C:\Folder\MyFile.txt
BCH.$$FIL|.||$$RET
DBP.$$RET
$$TES=Hallo.txt
ACH.$$TES|.||$$RES
DBP.$$RES
$$TES=Hallo.txt
BCH.$$TES|.||$$RES
DBP.$$RES
Remarks
-
Limitations:
-
See also: