WordCount (String function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 17: Line 17:
</td></tr>
</td></tr>
</table>
</table>
==Usage notes==
==Usage notes==
==Examples==
==Examples==
The following fragment:
The following fragment:
Line 25: Line 27:
<p class="output">"I'd like to buy the world a joke":WordCount=8
<p class="output">"I'd like to buy the world a joke":WordCount=8
</p>
</p>
==See also==
==See also==
<ul>
<ul>
<li>[[List of StringTokenizer methods]]
<li>[[List of StringTokenizer methods]]
<li><var>[[Word (String function)|Word]]</var> - Select word from list of words
<li><var>[[Words (String function)|Words]]</var> - Sublist of list of words
<li><var>[[Words (String function)|Words]]</var> - Sublist of list of words
<li><var>[[WordNumberIn and WordNumberOf (String functions)|WordNumberIn and WordNumberOf]]</var> - Word number of "needle" word within "haystack" list of words
<li><var>[[Word (String function)|Word]]</var>, which selects a word from a list of words
<li><var>WordCount</var> is the OO version of <var>$Lstr_Words</var>.
<li><var>[[WordNumberIn and WordNumberOf (String functions)|WordNumberIn and WordNumberOf]]</var>, which returns the word number of a "needle" word within a "haystack" list of words
</ul>
</ul>
{{Template:String:WordCount footer}}
{{Template:String:WordCount footer}}

Revision as of 18:30, 21 March 2012

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

%numberWordCount 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