Xbasic

WORDAT Function

Syntax

Position as N = WORDAT(C word,C string[,C separator])

Arguments

word

The word to find in Input_String. Character

string

A character string.

separator

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

Description

Returns which word matches (1 based,0 means no match).

Discussion

WORDAT() returns the word number of Word in string. Case insensitive. If the optional separator parameter is not specified, a word is any sequence of one or more characters separated either by a space or the start or end of the string. WORDAT() is a case insensitive version of WORDATC().

Example

wordat("test", "This is a test") -> 4
dim fruits as C
fruits = "apple" + crlf() + "banana" + crlf() + "grape" + crlf() + "peach" + crlf() + "plum"
wordat("banana", fruits, crlf() ) ? 2

See Also