<< Click to Display Table of Contents >> Navigation: 3. Script Language > TXT. Text-File Engine > CSV-Related Commands > Delimited_Items_Remove |
MiniRobotLanguage (MRL)
TXT.Delimited_Items_Remove
Remove specified Fields from a Delimited String, similar to DIC.Remove, but process the whole TXT.-Buffer, not just a line.
Intention
This command does the same like DIC.Remove but will process the whole TXT.-Buffer "Line by Line".
Therefore it does not need an Line-Specifier.
The following Sample is from DIC.Remove
Assume you have a Line like this:
AA;BB;CC;DD;EE;FF
as you can read it Line-by-line out of a csv.-file
Now, you decide that you want to remove Columns 1,3, and 5.
' This is the delimiter character
VAR.$$DEL=;
' This is the Line that has delimited items
VAR.$$LIN=AA;BB;CC;DD;EE;FF
' This is the Index-List with the Elements where we want to insert new fiels before
VAR.$$IND="A","E",3
' Now we call the command
DIC.remove|$$DEL|$$LIN|$$IND|$$RES
' And Debug-Print the Result
DBP.$$RES
ENR
And this is the result: BB;DD;FF
Syntax
TXT.dir|P1|P2
Parameter Explanation
P1 - Delimiter, can be a Single character like semicolon or multiple characters like $crlf$.
This is the specified delimiter that delimits the fields in the specified Line P2.
P2 - Variable with Index of Fields to remove.
Can be Single number like 1 or can be an Letter like "A". You can give a comma-separated list with Numbers of the fields to get.
Example
'***********************************
' DIC.Remove - Sample
'***********************************
' This is the delimiter character
VAR.$$DEL=;
' This is the Line that has delimited items
VAR.$$LIN=AA;BB;CC;DD;EE;FF
' This is the Index-List with the Elements where we want to insert new fiels before
VAR.$$IND="A","E",3
' Now we call the command
DIC.Remove|$$DEL|$$LIN|$$IND|$$RES
' And Debug-Print the Result
DBP.$$RES
' Result:
' BB;DD;FF
ENR
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