WORD2 Function


Output_String as C = word2(C character ,N word_number [,C separator [,N num_words ]])



A character string.


An integer that specifies which word to return, counting left to right. If the Word_Number is negative, WORD() counts words from right to left. Numeric


Optional. Default = space (" "). The character that delimits words. If the optional Word_Delimiter 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. If Word_Delimiter is specified, then Alpha Anywhere returns the strings that are delimited by the Word_Delimiter. If a null delimiter (e.g. ""), is specified, WORD2() treats the delimiter as the same as the default delimiter (e.g. " "). Contrast with WORD() which returns a null string if a null delimiter is specified. Character


Optional. Default = 1. Specifies the number of words in the Input_String to return. Numeric


Just like word() except it allows num_words to be used with the default separators if ""


WORD2() returns one or more words, specified by the word_number and num_words and delimited by a separator, from C character.


? word2("This is a test", 4)
= "test"
dim FULLNAME as C = "Di King"
? word2(FULLNAME, 1)
= "Di"
DIM FULLNAME as C = "John J. Smith"
? word2(FULLNAME, w_count(FULLNAME))
= "Smith"
? word2("the quick brown fox", -1)
= "fox"
? word2("John Smith, Alpha Software, BurlingtonMA01803", 3, ",")
= "BurlingtonMA01803"
? word2("now is the time", 2, " ", 3)
= "is the time"

See Also