WordCount (String function)

From m204wiki
Revision as of 23:00, 3 September 2015 by ELowell (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Count words in list (String class)

[Introduced in Sirius Mods 7.9]

WordCount returns the number of words in its method object string.

Note that processing a string of words may be better accomplished with the StringTokenizer class.


%number = string:WordCount[( [Spaces= string])]

Syntax terms

%numberA numeric variable to contain the number of words in the string method object.
string The string that is the list of words to be counted.
Spaces This optional, name required, argument is a set of "whitespace" characters, that is, characters that separate words. The default is the blank character. If the null string is provided, the blank character is used as the whitespace character.

Usage notes


The following fragment:

PrintText {~="I'd like to buy the world a joke":WordCount}

produces this result:

"I'd like to buy the world a joke":WordCount=8

See also