string.nthField

Syntax string.nthField (string, delimiter, index)

Params string is the string from which you wish to extract a field.

delimiter is the character that separates fields within the string.

index is a number indicating the 1-based index position of the field within string you wish to extract.

Action Extracts from string the field at position index, with fields defined as strings of characters separated by a single delimiter character.

Returns The indicated field.

Examples string.nthField ("Eat a good lunch!", ' ', 3)

   » good

string.nthField ("Coming,,into,being, is here.", ',', 5)

   » is here.

string.nthField ("people.DW.notepad", '.', 2)

   » DW

Notes If index < 1, or if index > the number of fields in string, this verb returns the empty string.

Using this verb with a space as the delimiter may not produce the same results as string.nthWord, since the two verbs will treat consecutive spaces differently.

See Also string.nthWord

Discuss