$Lstr Words: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
mNo edit summary
Line 2: Line 2:
<span class="pageSubtitle"><section begin="desc" />Return the number of words in a long string<section end="desc" /></span>
<span class="pageSubtitle"><section begin="desc" />Return the number of words in a long string<section end="desc" /></span>


<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Lstr_Words function is [[to be entered]].</p>
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no direct OO equivalent for the $Lstr_Words function, but the functionality is available in the [[StringTokenizer class]].</p>


This function takes a string or longstring input and returns a number indicating the word position of the second argument within the long string. If the word is not present, zero is returned.  
This function takes a string or longstring input and returns a number indicating the word position of the second argument within the long string. If the word is not present, zero is returned.  
Line 11: Line 11:


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.
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==
==Syntax==
<p class="syntax"><section begin="syntax" /> %RESULT = $Lstr_Words(longstring, delims)
<p class="syntax"><section begin="syntax" /> %RESULT = $Lstr_Words(longstring, delims)
Line 18: Line 19:
<p class="caption">%RESULT is the count of words in the longstring.</p>
<p class="caption">%RESULT is the count of words in the longstring.</p>


For example, the following statement sets %RES to <tt>8.</tt>:
For example, the following statement sets %RES to <tt>8</tt>:
 
<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>:
This statement sets %RES to <tt>7</tt>:
<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>


$Lstr_Words is only available in ''[[Sirius Mods]]'' Version 6.5 and later.


For more information see :hdref refid=lstr..
<p>
 
$Lstr_Words is only available in ''[[Sirius Mods]]'' Version 6.5 and later.<p>
 
<ul class="smallAndTightList">
<ul class="smallAndTightList">
<li>[[Sirius functions]]</li>
<li>[[Sirius functions]]</li>
Line 39: Line 41:
<li>[[Japanese functions]]</li>
<li>[[Japanese functions]]</li>
<li>[[Sir2000 Field Migration Facility]]</li>
<li>[[Sir2000 Field Migration Facility]]</li>
 
</ul>  
</ul>
</p>
</p>
<p class="caption">Products authorizing $Lstr_Words
<p class="caption">Products authorizing $Lstr_Words
</p>
</p>


[[Category:$Functions|$Lstr_Words]]
[[Category:$Functions|$Lstr_Words]]

Revision as of 14:36, 11 February 2011

<section begin="desc" />Return the number of words in a long string<section end="desc" />

Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no direct OO equivalent for the $Lstr_Words function, but the functionality is available in the StringTokenizer class.

This function takes a string or longstring input and returns a number indicating the word position of the second argument within the long string. If the word is not present, zero is returned.

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" />

$Lstr_Words function

%RESULT is the count of words in the longstring.

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.

Products authorizing $Lstr_Words