<< Click to Display Table of Contents >> Navigation: 3. Script Language > String commands > String Operations |
MiniRobotLanguage (MRL)
SRT. Command
SoRT delimited items
Intention
This command is used to sort delimited items alphabetically.
Items in this definitions are members of a string, delimited with a known delimiter.
In a Text-file which has been loaded, the delimiter would be $crlf$ for example.
Usage can be as easy as calling:
VAR.$$TXT=Name Last-Name Zip-Code
SRT.$$TXT
DBP.$$TXT
Now for special reasons you can specify more parameters. For example:
VAR.$$TXT=Name Last-Name Zip-Code
SRT.$$TXT|$sp$|d
DBP.$$TXT
' returns "Last-Name Name Zip-Code"
or change to ascending sort-order:
VAR.$$TXT=Name Last-Name Zip-Code
SRT.$$TXT|$sp$|a
DBP.$$TXT
' returns "Zip-Code Name Last-Name"
Syntax
SRT.P1[|P2][|P3][|P4]
Parameter Explanation
P1 - String with delimited elements to sort.
P2 - (optional) Delimiter-Char
P3 - (optional) "a" or "d" - ascending sort or descending
sort-order
P4 - (optional) "Tag-String".
This string is internally generated and shows how the source
string has been sorted.
If you omit the P2 delimiter, the command will try to find it automatically.
Example
' Keyword-Sorter
' This script reads a file with keywords
' it replaces the delimiter and removes double delimiters
' and double Keywords.
' It will then sort the keywords and save them in another file.
'
' Its an example for RPL., FEM. and SRT.
'
'-------------------------
': §§SRF=Gesamt-Original
: §§SRF=reinigungsmittel
: §§FIL=?pfad\§§SRF.txt
: §§TAA=?pfad\§§SRF-csv.csv
: §§TAB=?pfad\§§SRF-txt.txt
VAR.§§SON=$crlf$$tab$
VAR.§§SOA=$sp$
: §§TMP=
: §§COA=
DEL.§§TAR
CFF.§§FIL|§§CON
RPL.§§CON|,|;
RPL.§§CON| |§§SOA|d
RPL.§§CON|§§SON|;|a
RPL.§§CON|;;|;
RPL.§§CON|; ;|;
RPL.§§CON|;;|;
SRT.§§CON|;
FEM.DoIt|§§MEM|§§CON|;
CTF.§§TAA|§§COA
RPL.§§COA|;|,
CTF.§§TAB|§§COA
END.
:DoIt
IVV.§§TMP!§§MEM
PRT.Adding: §§MEM
VAR.§§COA=§§COA;§§MEM
ELS.
PRT. Deleting: §§MEM
EIF.
VAR.§§TMP=§§MEM
RET.
Remarks
-
Limitations:
-
See also:
• 1.5.2 Working with Text-Strings
• VAR. - Variable Set Value/Clear
• IVS. / NVS. - If-Variable-String
• SBD. - String between Delimiter
• SBM. - String between Delimiter-Multiple