$Lstr Word: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
m (misc cleanup)
 
(11 intermediate revisions by 2 users not shown)
Line 2: Line 2:
<span class="pageSubtitle">Return a word from a long string</span>
<span class="pageSubtitle">Return a word from a long string</span>


<p class="warn"><b>Note: </b>Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for $Lstr_Word is <var>[[Word (String function)|Word]]</var> (<b>except</b> that <var>Word</var> does not allow a word number argument less than 1, as does $Lstr_Word.) Or, you may find the features of the [[StringTokenizer class|StringTokenizer]] to be more helpful.</p>
<p class="warn"><b>Note: </b>Most SOUL $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for $Lstr_Word is <var>[[Word (String function)|Word]]</var> (<b>except</b> that <var>Word</var> does not allow a word number argument less than 1, as does $Lstr_Word.) Or, you may find the features of the [[StringTokenizer class|StringTokenizer]] to be more helpful.</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 <var>Longstring</var> input and a word number and returns a <var>Longstring</var> containing a single word. A null string is returned if the word count in the input <var>Longstring</var> is less than the word number.  


The <var>$Lstr_Word</var> function accepts three arguments and returns a longstring result.
==Syntax==
<p class="syntax"><span class="term">%result</span> = $Lstr_Word(<span class="term">longstring</span>, <span class="term">n</span>, <span class="term">delims</span>)
</p>


The first argument is an arbitrary longstring. This is a required argument.  
<p><var class="term">%result</var> is  a <var>Longstring</var> that is the <var class="term">n</var>th word in the <var class="term">longstring</var> argument.</p>


The second argument is the number of the desired word. The first word in the input longstring is word 1.
<var class="term">longstring</var> is an arbitrary <var>Longstring</var>. This is a required argument.
 
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==
<p class="syntax"><span class="term">%result</span> = $Lstr_Word(longstring, n, delims)
</p>


<p><var class="term">%result</var> is the ''n''th word in the longstring.</p>
<var class="term">n</var> is the number of the desired word. The first word in the <var class="term">longstring</var> input is word 1.


==Usage notes==
<var class="term">delims</var> is a string containing from 1 to 255 characters which are the delimiters for <var class="term">longstring</var>. This is an optional argument, and it defaults to a blank.
<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==
==Examples==
<ol>
<ol>
<li>To set %RES to "shore":
<li>To set <var class="term">%res</var> to "shore":
<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>


<li>To set %RES to "sea":
<li>To set <var class="term">%res</var> 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>
</ol>
Line 39: Line 32:
==See also==
==See also==
<ul>
<ul>
<li><var>[[Word (String function)|Word]]</var> - Select word from list of words
<li><var>[[Word (String function)|Word]]</var> &mdash; Select word from list of words
<li><var>[[Words (String function)|Words]]</var> - Sublist of list of words
<li><var>[[Words (String function)|Words]]</var> &mdash; Sublist of list of words
<li><var>[[WordCount (String function)|WordCount]]</var> - Count words in list
<li><var>[[WordCount (String function)|WordCount]]</var> &mdash; Count words in list
<li><var>[[WordNumberIn and WordNumberOf (String functions)|WordNumberIn and WordNumberOf]]</var> - Word number of "needle" word within "haystack" list of words
<li><var>[[WordNumberIn and WordNumberOf (String functions)|WordNumberIn and WordNumberOf]]</var> &mdash; Word number of "needle" word within "haystack" list of words
</ul>
</ul>


Line 48: Line 41:
==Products authorizing {{PAGENAMEE}}==  
==Products authorizing {{PAGENAMEE}}==  
<ul class="smallAndTightList">
<ul class="smallAndTightList">
<li>[[Sirius functions]]</li>
<li>[[List of $functions|Sirius functions]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[http://m204wiki.rocketsoftware.com/images/4/4a/JoclrNew.pdf Janus Open Client]</li>
<li>[[Media:JoclrNew.pdf|Janus Open Client]]</li>
<li>[[Janus Open Server]]</li>
<li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Web Server]]</li>
<li>[[Janus Web Server]]</li>
<li>[[Japanese functions]]</li>
<li>Japanese functions</li>
<li>[[Sir2000 Field Migration Facility]]</li>
<li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li>
</ul>  
</ul>  
</p>
<p>
</p>
</p>


[[Category:$Functions|$Lstr_Word]]
[[Category:$Functions|$Lstr_Word]]

Latest revision as of 16:50, 29 February 2016

Return a word from a long string

Note: Most SOUL $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.

Syntax

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

%result is a Longstring that is the nth word in the longstring argument.

longstring is an arbitrary Longstring. This is a required argument.

n is the number of the desired word. The first word in the longstring input is word 1.

delims is a string containing from 1 to 255 characters which are the delimiters for longstring. This is an optional argument, and it defaults to a blank.

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