Xbasic

WORD_FROM_POS Function

Syntax

Word_Number as N = WORD_FROM_POS(C text,N pos,[,C separator])

Arguments

text

A character string.

pos

A character position within the Input_String. Numeric

separator

Optional. Default = space (" "). The character string that separates words.

Description

Given a character position, return the 'word' that character is in.

Discussion

Converts the position in a text string to the number of the word in the text string. If Position, pos, occurs on a separator, Word_Number is 0.

Example

word_from_pos("This is a test", 7) -> 2

See Also