Difference between revisions of "GETWORDCOUNT()"

From Lianjapedia
Jump to: navigation, search
(Created page with '==Purpose== Function to return the number of words in a string ==Syntax== GETWORDCOUNT(<expC1> [, <expC2>]) ==See Also== AT(), ATNEXT(), GETWORDNUM(), INLIST(),…')
 
Line 9: Line 9:
  
 
==Description==
 
==Description==
GETWORDCOUNT() returns the number of words in the string <expC1>.  By default, words are assumed to be separated by spaces.  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.
+
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==
 
==Example==

Revision as of 10:36, 14 November 2012

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 "."