$Lstr Word: Difference between revisions
(Automatically generated page update) |
m (misc cleanup) |
||
(15 intermediate revisions by 3 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=" | <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 | 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. | ||
==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> | |||
<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> | |||
<var class="term">longstring</var> is an arbitrary <var>Longstring</var>. This is a required argument. | |||
<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. | |||
<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. | |||
</ | |||
< | |||
</ | |||
==Examples== | |||
<p class="code"> % | <ol> | ||
<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> | </p> | ||
<li>To set <var class="term">%res</var> to "sea": | |||
<p class="code"> % | <p class="code">%res = $Lstr_Word('She sells sea-shells by the sea shore', 7, '- ') | ||
</p> | </p> | ||
</ol> | |||
==See also== | ==See also== | ||
<ul> | <ul> | ||
<li><var>[[Word (String function)|Word]]</var> | <li><var>[[Word (String function)|Word]]</var> — Select word from list of words | ||
<li><var>[[Words (String function)|Words]]</var> | <li><var>[[Words (String function)|Words]]</var> — Sublist of list of words | ||
<li><var>[[WordCount (String function)|WordCount]]</var> | <li><var>[[WordCount (String function)|WordCount]]</var> — Count words in list | ||
<li><var>[[WordNumberIn and WordNumberOf (String functions)|WordNumberIn and WordNumberOf]]</var> | <li><var>[[WordNumberIn and WordNumberOf (String functions)|WordNumberIn and WordNumberOf]]</var> — Word number of "needle" word within "haystack" list of words | ||
</ul> | </ul> | ||
Line 45: | 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>[[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> | <li>Japanese functions</li> | ||
<li>[[Sir2000 Field Migration Facility]]</li> | <li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li> | ||
</ul> | </ul> | ||
</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
- To set %res to "shore":
%res = $Lstr_Word('She sells sea-shells by the sea shore', 7)
- To set %res to "sea":
%res = $Lstr_Word('She sells sea-shells by the sea shore', 7, '- ')
See also
- Word — Select word from list of words
- Words — Sublist of list of words
- WordCount — Count words in list
- WordNumberIn and WordNumberOf — Word number of "needle" word within "haystack" list of words