$Lstr Words: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
Line 15: Line 15:
<p class="syntax"><span class="term">%result</span> = $Lstr_Words(longstring, delims)
<p class="syntax"><span class="term">%result</span> = $Lstr_Words(longstring, delims)
</p>
</p>
<p class="caption">$Lstr_Words function
 
</p>
<p>%result is the count of words in the longstring.</p>
<p>%result is the count of words in the longstring.</p>


For example, the following statement sets %RES to <tt>8</tt>:
==Examples==
<ol>
<li>The following statement sets %RES to <code>8</code>:


<p class="code"> %RES = $Lstr_Words('Picture yourself in a boat on a river')
<p class="code">%RES = $Lstr_Words('Picture yourself in a boat on a river')
</p>
</p>


This statement sets %RES to <tt>7</tt>:
<li>This statement sets %RES to <code>7</code>:


<p class="code"> %RES = $Lstr_Words('Picture yourself in a boat on a river', 'a ')
<p class="code">%RES = $Lstr_Words('Picture yourself in a boat on a river', 'a ')
</p>
</p>
 
</ol>
<var>$Lstr_Words</var> is only available in <var class="product">[[Sirius Mods]]</var> Version 6.5 and later.


==See also==
==See also==

Revision as of 01:27, 19 July 2013

Return the number of words in a long string

Note: 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

%result = $Lstr_Words(longstring, delims)

%result is the count of words in the longstring.

Examples

  1. The following statement sets %RES to 8:

    %RES = $Lstr_Words('Picture yourself in a boat on a river')

  2. This statement sets %RES to 7:

    %RES = $Lstr_Words('Picture yourself in a boat on a river', 'a ')

See also

Products authorizing $Lstr_Words