$Lstr SubWord: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
Line 21: Line 21:
<p class="syntax"><span class="term">%result</span> = $Lstr_SubWord(longstring, start, words, delim)
<p class="syntax"><span class="term">%result</span> = $Lstr_SubWord(longstring, start, words, delim)
</p>
</p>
<p class="caption">$Lstr_SubWord function
</p>
<p>%result is a substring of the input longstring.</p>


For example
<p><var class="term">%result</var> is a substring of the input longstring.</p>


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


sets %RES to "a time." and
<li>To set %res to <code>upon a</code>:
 
<p class="code">%res = $Lstr_SubWord('Once upon a time you dressed so fine', 3, 2, ' n')
<p class="code"> %RES = $Lstr_SubWord('Once upon a time you dressed so fine', 3, 2, ' n')
</p>
</p>
 
</ol>
sets %RES to "upon a"
 
<var>$Lstr_SubWord</var> is only available in <var class="product">[[Sirius Mods]]</var> Version 6.5 and later.<p>


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

Revision as of 00:46, 19 July 2013

Substring of a longstring using word counts

Note: Most Sirius $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 arguments and returns a long string result.

The first argument is an arbitrary string or longstring. This is a required argument.

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.

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.

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.

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

Syntax

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

%result is a substring of the input longstring.

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