$Lstr Word: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
Line 17: Line 17:
<p class="syntax"><span class="term">%result</span> = $Lstr_Word(longstring, n, delims)
<p class="syntax"><span class="term">%result</span> = $Lstr_Word(longstring, n, delims)
</p>
</p>
<p class="caption">$Lstr_Word function
 
</p>
<p>%result is the ''n''th word in the longstring.</p>
<p>%result is the ''n''th word in the longstring.</p>


For example
==Usage notes==
<p class="code"> %RES = $Lstr_Word('She sells sea-shells by the sea shore', 7)
<ul>
<li>Prior to <var class="product">Sirmods</var> Version 7.3 (or Version 7.1 or 7.2, with maintenance applied), if the result of <var>$Lstr_Word</var> was longer than 255 bytes, either the request was cancelled or the result was truncated at 255 bytes.
</ul>
 
==Examples==
<ol>
<li>To set %RES to "shore":
<p class="code">%RES = $Lstr_Word('She sells sea-shells by the sea shore', 7)
</p>
</p>


sets %RES to "shore" and
<li>To set %RES to "sea":


<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>
 
</ol>
sets %RES to "sea".
 
<var>$Lstr_Word</var> is only available in <var class="product">[[Sirius Mods]]</var> Version 6.5 and later. Prior to Version 7.3 (or Version 7.1 or 7.2, with maintenance applied), if the result of <var>$Lstr_Word</var> was longer than 255 bytes, either the request was cancelled or the result was truncated at 255 bytes.


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

Revision as of 01:25, 19 July 2013

Return a word from a long string

Note: Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for $Lstr_Word is Word (except that Word does not allow a word number argument less than 1, as does $Lstr_Word.) Or, you may find the features of the StringTokenizer to be more helpful.

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

%result = $Lstr_Word(longstring, n, delims)

%result is the nth word in the longstring.

Usage notes

  • Prior to Sirmods 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.

Examples

  1. To set %RES to "shore":

    %RES = $Lstr_Word('She sells sea-shells by the sea shore', 7)

  2. To set %RES to "sea":

    %RES = $Lstr_Word('She sells sea-shells by the sea shore', 7, '- ')

See also

Products authorizing $Lstr_Word