GETWORDCOUNT()

From Lianjapedia
Jump to: navigation, search

Purpose

Function to return the number of words in a string

Syntax

GETWORDCOUNT(<expC1> [, <expC2>])

See Also

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

Description

GETWORDCOUNT() returns the number of words in the string <expC1>. By default, words are assumed to be separated by spaces or tabs. 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.

Example

cString = "AAA aaa, BBB bbb, CCC ccc.  DDD ddd."
? getwordcount(cString)               // = 8 character groups delimited by space
? getwordcount(cString, ",")          // = 3 character groups delimited by ","
? getwordcount(cString, ".")          // = 2 character groups delimited by "."
? getwordcount(cString, ",.")         // = 4 character groups delimited by "," or "."