NthField Function

Returns a field from a row of data. The first field is numbered 1.

Syntax
result = NthField( source, separator, fieldNumber )
result = stringVariable.NthField( separator, fieldNumber )

Parameters
source | String | The fields of data.
separator | String | The character that separates the columns of data.
fieldNumber | Integer | The column number of the field of data desired. The first field is numbered 1.

Return Value
Result | String | The field value desired.

# Notes

If you need to parse binary data, use NthFieldB instead.

The NthField function returns the field value from the source that precedes the fieldNumber occurrence of the separator in the source.

If fieldNumber is out of bounds, an empty string is returned. NthField is not case-sensitive.

# Examples

## This example returns "Smith"

Dim field As String
field=NthField("Dan*Smith*11/22/69*5125554323*Male","*",2)

.

Using the second syntax:

Dim s,field As String
s="Dan*Smith*11/22/69*5125554323*Male"
field=s.NthField("*",2)
MsgBox field

See also the example that illustrates how to populate a PopupMenu control.

# See Also

CountFields, NthFieldB, Split functions.