$Lstr SubWord: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Created page with "{{DISPLAYTITLE:$Lstr_SubWord}} <span class="pageSubtitle"><section begin="desc" />Substring of a longstring using word counts<section end="desc" /></span> <p class="warning">Mos...")
 
(Automatically generated page update)
 
(45 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:$Lstr_SubWord}}
{{DISPLAYTITLE:$Lstr_SubWord}}
<span class="pageSubtitle"><section begin="desc" />Substring of a longstring using word counts<section end="desc" /></span>
<span class="pageSubtitle">Substring of a longstring using word counts</span>


<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Lstr_SubWord function is [[to be entered]].</p>
<p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for $Lstr_SubWord is <var>[[Words (String function)|Words]]</var>. Or, you may find the features of the [[StringTokenizer class|StringTokenizer]] to be more helpful.</p>


This function takes a string or longstring input and produces a substring of the input using word counts.  
This function takes a string or [[Longstrings|longstring]] input and produces a substring of the input using word counts.  


The $Lstr_SubWord function accepts four arguments and returns a long string result.  
The <var>$Lstr_SubWord</var> function accepts four arsguments and returns a longstring result.  


The first argument is an arbitrary string or longstring. This is a required argument.  
==Syntax==
<p class="syntax"><span class="term">%result</span> = $Lstr_SubWord(<span class="term">longstring</span>, <span class="term">start</span>, [<span class="term">words</span>], [<span class="term">delim</span>])
</p>
 
===Syntax terms===
<table>
<tr><th>%result</th>
<td>A substring of the input longstring. </td></tr>
 
<tr><th>longstring</th>
<td>An arbitrary string or longstring. This is a required argument</td></tr>
 
<tr><th>start</th>
<td>A number between 1 and 2**31-1 that indicates the starting word number in the input string. This is a required argument. </td></tr>


The second argument is a number between 1 and 2**31-1 that indicates the starting word number in the input string. This is a required argument.  
<tr><th>words</th>
<td>A number between 1 and 2**31-1 that indicates the length in words of the result string. This is an optional argument and defaults to the number of words left in the string. </td></tr>


The third argument is a number between 1 and 2**31-1 that indicates the length in words of the result string. This is an optional argument and defaults to the number of words left in the string.  
<tr><th>delim</th>
<td>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. </td></tr>
</table>


The fourth 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.  
==Usage notes==
<ul>
<li>Leading and trailing delimiters are removed from the resulting string, but all delimiters within the boundaries of the result are preserved.
</ul>


Leading and trailing delimiters are removed from the resulting string, but all delimiters within the boundaries of the result are preserved.
==Examples==
==Syntax==
<ol>
<p class="syntax"><section begin="syntax" /> %RESULT = $Lstr_SubWord(longstring, start, words, delim)
<li>To set <code>%res</code> to <code>a time</code>:
<section end="syntax" /></p>
<p class="code">%res = $Lstr_SubWord('Once upon a time you dressed so fine', 3, 2)
<p class="caption">$Lstr_SubWord function
</p>
</p>
<p class="caption">%RESULT is a substring of the input longstring.</p>


For example
<li>To set <code>%res</code> to <code>upon a</code>:
<p class="code"> %RES = $Lstr_SubWord('Once upon a time you dressed so fine', 3, 2)
<p class="code">%res = $Lstr_SubWord('Once upon a time you dressed so fine', 3, 2, ' n')
</p>
</p>
sets %RES to "a time." and
</ol>
<p class="code"> %RES = $Lstr_SubWord('Once upon a time you dressed so fine', 3, 2, ' n')
</p>
sets %RES to "upon a"


For more information see :hdref refid=lstr..
==See also==
 
<ul>
$Lstr_SubWord is only available in ''[[Sirius Mods]]'' Version 6.5 and later.<p>
<li><var>[[Word (String function)|Word]]</var> - Select word from list of words
<li><var>[[Words (String function)|Words]]</var> - Sublist of list of words
<li><var>[[WordCount (String function)|WordCount]]</var> - 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
</ul>


==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>[[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 class="caption">Products authorizing $Lstr_SubWord
</p>
 


[[Category:$Functions|$Lstr_SubWord]]
[[Category:$Functions|$Lstr_SubWord]]

Latest revision as of 22:52, 20 September 2018

Substring of a longstring using word counts

Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for $Lstr_SubWord is Words. Or, you may find the features of the StringTokenizer to be more helpful.

This function takes a string or longstring input and produces a substring of the input using word counts.

The $Lstr_SubWord function accepts four arsguments and returns a longstring result.

Syntax

%result = $Lstr_SubWord(longstring, start, [words], [delim])

Syntax terms

%result A substring of the input longstring.
longstring An arbitrary string or longstring. This is a required argument
start A number between 1 and 2**31-1 that indicates the starting word number in the input string. This is a required argument.
words A number between 1 and 2**31-1 that indicates the length in words of the result string. This is an optional argument and defaults to the number of words left in the string.
delim 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.

Usage notes

  • Leading and trailing delimiters are removed from the resulting string, but all delimiters within the boundaries of the result are preserved.

Examples

  1. To set %res to a time:

    %res = $Lstr_SubWord('Once upon a time you dressed so fine', 3, 2)

  2. To set %res to upon a:

    %res = $Lstr_SubWord('Once upon a time you dressed so fine', 3, 2, ' n')

See also

Products authorizing $Lstr_SubWord