WordCount (String function)
Count words in list (String class)
[Introduced in Sirius Mods 7.9]
Note that processing a string of words may be better accomplished with the StringTokenizer class.
Syntax
%number = string:WordCount[( [Spaces= string])]
Syntax terms
%number | WordCount returns the number of words in the string method object. |
---|---|
string | The list of words to be counted. |
Spaces | 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
Examples
The following fragment:
PrintText {~="I'd like to buy the world a joke":WordCount}
produces the following result:
"I'd like to buy the world a joke":WordCount=8
See also
- List of StringTokenizer methods
- Word - Select word from list of words
- Words - Sublist of list of words
- WordNumberIn and WordNumberOf - Word number of "needle" word within "haystack" list of words
- WordCount is the OO version of $Lstr_Words.