Xbasic

WORDS Function

Syntax

Output_String as C = WORDS(C character[,N word_number[,N count[,L keyword[,C separator]]]])

Arguments

character

A character string.

word_number

An integer that specifies which word to return, counting left to right. Numeric

count

Optional. Default = 1. The number of words to return. Zero (0) returns all words. Numeric

keyword

Optional. Default = .T. (TRUE). Specifies that Alpha Anywhere should use the same rules for delimiting words that the KEYWORD() function uses. Logical

separator

Optional. Default = space (" "). Specifies the word separator . If Separator is specified, the Keyword argument is ignored. Separator is particularly useful with CR-LF delimited lists, in which case separator is "crlf() ".

Description

Returns words, stripping out all whitespace.

Discussion

Returns count of words from character, starting with the word identified by word_number.

Example 

Assume that "fruits" is a CR-LF delimited list with these values:

Apple 
 Orange 
 Pear 
 Banana 
 Plum

words(fruits, 3, 2, .T., crlf() ) ->
Pear
Banana
words(fruits, 2, 2, .T.) -> "Orange Pear"

See Also