DIC.Get_Fields

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > String commands > !DIC.-Delimited Item Commands >

DIC.Get_Fields

MiniRobotLanguage (MRL)

 

DIC.Get_Fields

Get specified Fields from a Delimited String in the Original Order

 

 

Intention

 

Assume you have a Line like this:

AA;BB;CC;DD;EE;FF

as you can read it Line-bs-line out of a csv.-file

 

Now, you decide that you only need the Columns 1,2, and 5.

Note that with this Command, you can specify the Columns in any order, the result will be the same.

 

' 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 that we want to get in the result

VAR.$$IND="A","E",2

 

' Now we call the Command

DIC.Get|$$DEL|$$LIN|$$IND|$$RES  

 

' And Debug-Print the Result

DBP.$$RES

 

' Result:

' BB;DD;FF

ENR

 

And this is the result: BB;DD;FF

 

 

 

 

 

Syntax

 

DIC.Get_Fields|P1|P2|P3[|P4]

 

 

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 - Line with delimited Items.

P3 - Variable with Index of Fields to get. 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.

P4 - (optional) Variable for Result. If omitted result is placed on TOS.

 

 

 

Example

 

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

' DIC.Get - 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 that we want to get in the result

VAR.$$IND="A","E",2

 

' Now we call the Command

DIC.Get|$$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

•GSS. - GetSplitString

•SRT. - Sort Items

•! STR. - String Command

•GES. - Get-Extracted-String

•SBD. - String between Delimiter

•SBM. - String between Delimiter-Multiple

•FEM. - For Each Member

•LEN. - Length-of-String

•DIC.-Delimited Item Commands

•DIC.Eval_Column_List

•DIC.Format_Numeric

•DIC.Get_Field_Index

•DIC.Get_in_Order

•DIC.Insert

•DIC.Letter_to_Number

•DIC.Number_to_Letter

•DIC.Remove

•DIC.Set_Multiple

•DIC.Set_Value

•DIC.Swap

•