Xbasic
WORD_NUMBER_GET Function
Syntax
Position as N = word_number_get(C string ,C substring ,C delimiter [,L match_full_words_only [,L caseSensitive ]])
Arguments
- string
The list to examine.
- substring
The character string to find. Case sensitive.
- delimiter
Default = CR-LF. The separator between character strings. Note that the space (" ") character may not be used as a delimiter.
- match_full_words_only
Logical. Optional. Default = .F. .T. = Match full words only .F. = Match character strings or full words
- caseSensitive
Logical. Optional. Default = .F. .T. = Match only words with same case .F. = Ignore case
Description
Returns the word number of the word in which substring was found.
Discussion
WORD_NUMBER_GET() returns the integer list position of the Find_String in the Search_In_String. Each character string must be separated by a delimiter, which by default is CR-LF. The function returns 0 if Find_String was not found.
Example
? word_number_get(cstates() , "Maryland", crlf() ) = 21 ? word_number_get(cstates() , "Mary", crlf() , .T.) = 0 ? word_number_get(cstates() , "Mary", crlf() ) = 21 ? word_number_get(cstates() , "land", crlf() ) = 21 ? word_number_get(cstates() , "Max", crlf() ) = 0
See Also