$Lstr Words: Difference between revisions
m (1 revision) |
m (1 revision) |
||
Line 13: | Line 13: | ||
==Syntax== | ==Syntax== | ||
<p class="syntax"><section begin="syntax" /> %RESULT = $Lstr_Words(longstring, delims) | <p class="syntax"><section begin="syntax" />%RESULT = $Lstr_Words(longstring, delims) | ||
<section end="syntax" /></p> | <section end="syntax" /></p> | ||
<p class="caption">$Lstr_Words function | <p class="caption">$Lstr_Words function |
Revision as of 20:32, 24 October 2012
Return the number of words in a long string
Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for $Lstr_Words is WordCount. Or, you may find the features of the StringTokenizer to be more helpful.
This function takes a string or longstring input and returns the number of words in the long string.
The $Lstr_Words function accepts two arguments and returns a string result.
The first argument is an arbitrary string or longstring. This is a required argument.
The second argument is a string containing from 1 to 255 characters which are the delimiters for the longstring. This is an optional argument and defaults to a blank.
Syntax
<section begin="syntax" />%RESULT = $Lstr_Words(longstring, delims) <section end="syntax" />
For example, the following statement sets %RES to 8:
%RES = $Lstr_Words('Picture yourself in a boat on a river')
This statement sets %RES to 7:
%RES = $Lstr_Words('Picture yourself in a boat on a river', 'a ')
$Lstr_Words is only available in Sirius Mods Version 6.5 and later.
See also
- Word - Select word from list of words
- Words - Sublist of list of words
- WordCount - Count words in list
- WordNumberIn and WordNumberOf - Word number of "needle" word within "haystack" list of words