GETWORDNUM()

From Lianjapedia
Jump to: navigation, search

Purpose

Function to return the word at a specified position in a string

Syntax

GETWORDNUM(<expC1>, <expN> [, <expC2>])

See Also

AT(), ATNEXT(), GETWORDCOUNT(), INLIST(), LEFT(), OCCURS(), RAT(), RIGHT(), SET STRESCAPE, STR(), STREXTRACT(), STRPOS(), STRTRAN(), STUFF(), SUBSTR()

Description

GETWORDNUM() returns the word at the specified position <expN> in the string <expC1>. By default, words are assumed to be separated by spaces, tabs, line feeds or carriage returns. Alternative delimiting characters can be specified in <expC2>. If more than one delimiting character is included in <expC2>, each is counted as a delimiter, not the complete string as a single delimiter. If no word exists at position <expN>, GETWORDNUM() returns an empty string.

Example

cString = "AAA aaa, BBB bbb, CCC ccc.  DDD ddd."
? getwordnum(cString,2)        // 'aaa,'        
? getwordnum(cString,2, ",")   // ' BBB bbb'     
? getwordnum(cString,2, ".")   // '  DDD ddd'     
? getwordnum(cString,3, ",.")  // ' CCC ccc'