Xbasic

WORDATC Function

Syntax

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

Arguments

word

The word to find in Input_String.

string

A character string.

separator

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

Description

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

Discussion

WORDATC() returns the word number of Word in 'string'. Case sensitive. 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.

Example

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

Limitations

The Word argument is case sensitive.

See Also