GetField

Top  Previous  Next

This function will parse a comma delimited string and return the nth field. Returns a string, which will be converted to a number if necessary. This function is often used in conjunction with the file manager's ReadLine function to read comma delimited files.

See also RemoveCommasBetweenQuotes and RemoveNonDigits.

 

Syntax

 

returnString = GetField( stringValue, fieldIndex )

 

Parameters

stringValue

 

the comma delimited string

fieldIndex

 

the number of the field to extract

 

 

 

returns

 

the string value of the extracted field

 

Examples

stringValue = "S,10,20,30,40"

 

returnString = GetField( stringValue, 1 ) ' Returns "S"

 

returnValue = GetField( stringValue, 3 ) ' Returns the number 20

 

 

 

The GetField function replaced both the GetStringField and the GetNumberField functions from prior versions. This new function will return a string or a number as necessary.