$Lstr Word: Difference between revisions
m (1 revision) |
mNo edit summary |
||
Line 2: | Line 2: | ||
<span class="pageSubtitle"><section begin="desc" />Return a word from a long string<section end="desc" /></span> | <span class="pageSubtitle"><section begin="desc" />Return a word from a long string<section end="desc" /></span> | ||
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. | <p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no direct OO equivalent for the $Lstr_Word function, but the functionality is available in the [[StringTokenizer class]].</p> | ||
This function takes a longstring input and a word number and returns a longstring containing a single word. A null string is returned if the word count in the input longstring is less than the word number. | This function takes a longstring input and a word number and returns a longstring containing a single word. A null string is returned if the word count in the input longstring is less than the word number. | ||
Line 13: | Line 13: | ||
The third 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 third 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_Word(longstring, n, delims) | <p class="syntax"><section begin="syntax" /> %RESULT = $Lstr_Word(longstring, n, delims) | ||
Line 23: | Line 24: | ||
<p class="code"> %RES = $Lstr_Word('She sells sea-shells by the sea shore', 7) | <p class="code"> %RES = $Lstr_Word('She sells sea-shells by the sea shore', 7) | ||
</p> | </p> | ||
sets %RES to "shore | |||
sets %RES to "shore" and | |||
<p class="code"> %RES = $Lstr_Word('She sells sea-shells by the sea shore', 7, '- ') | <p class="code"> %RES = $Lstr_Word('She sells sea-shells by the sea shore', 7, '- ') | ||
</p> | </p> | ||
sets %RES to "sea". | |||
$Lstr_Word is only available in ''[[Sirius Mods]]'' Version 6.5 and later. Prior to Version 7.3 (or Version 7.1 or 7.2, with maintenance applied), if the result of $Lstr_Word was longer than 255 bytes, either the request was cancelled or the result was truncated at 255 bytes. | $Lstr_Word is only available in ''[[Sirius Mods]]'' Version 6.5 and later. Prior to Version 7.3 (or Version 7.1 or 7.2, with maintenance applied), if the result of $Lstr_Word was longer than 255 bytes, either the request was cancelled or the result was truncated at 255 bytes. | ||
<p> | |||
<ul class="smallAndTightList"> | <ul class="smallAndTightList"> | ||
<li>[[Sirius functions]]</li> | <li>[[Sirius functions]]</li> | ||
Line 41: | Line 44: | ||
<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_Word | <p class="caption">Products authorizing $Lstr_Word | ||
</p> | </p> | ||
[[Category:$Functions|$Lstr_Word]] | [[Category:$Functions|$Lstr_Word]] |
Revision as of 14:34, 11 February 2011
<section begin="desc" />Return a word from 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_Word function, but the functionality is available in the StringTokenizer class.
This function takes a longstring input and a word number and returns a longstring containing a single word. A null string is returned if the word count in the input longstring is less than the word number.
The $Lstr_Word function accepts three arguments and returns a longstring result.
The first argument is an arbitrary longstring. This is a required argument.
The second argument is the number of the desired word. The first word in the input longstring is word 1.
The third 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_Word(longstring, n, delims) <section end="syntax" />
For example
%RES = $Lstr_Word('She sells sea-shells by the sea shore', 7)
sets %RES to "shore" and
%RES = $Lstr_Word('She sells sea-shells by the sea shore', 7, '- ')
sets %RES to "sea".
$Lstr_Word is only available in Sirius Mods Version 6.5 and later. Prior to Version 7.3 (or Version 7.1 or 7.2, with maintenance applied), if the result of $Lstr_Word was longer than 255 bytes, either the request was cancelled or the result was truncated at 255 bytes.