$Lstr SubWord: Difference between revisions
m (1 revision) |
mNo edit summary |
||
Line 2: | Line 2: | ||
<span class="pageSubtitle"><section begin="desc" />Substring of a longstring using word counts<section end="desc" /></span> | <span class="pageSubtitle"><section begin="desc" />Substring of a longstring using word counts<section end="desc" /></span> | ||
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. | <p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no direct OO equivalent for the $Lstr_SubWord function, but the feature is supported as part of the [[StringTokenizer class]].</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 longstring input and produces a substring of the input using word counts. | ||
Line 17: | Line 17: | ||
Leading and trailing delimiters are removed from the resulting string, but all delimiters within the boundaries of the result are preserved. | Leading and trailing delimiters are removed from the resulting string, but all delimiters within the boundaries of the result are preserved. | ||
==Syntax== | ==Syntax== | ||
<p class="syntax"><section begin="syntax" /> %RESULT = $Lstr_SubWord(longstring, start, words, delim) | <p class="syntax"><section begin="syntax" /> %RESULT = $Lstr_SubWord(longstring, start, words, delim) | ||
Line 25: | Line 26: | ||
For example | For example | ||
<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) | ||
</p> | </p> | ||
sets %RES to "a time." and | sets %RES to "a time." and | ||
<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> | ||
sets %RES to "upon a" | sets %RES to "upon a" | ||
$Lstr_SubWord is only available in ''[[Sirius Mods]]'' Version 6.5 and later.<p> | $Lstr_SubWord is only available in ''[[Sirius Mods]]'' Version 6.5 and later.<p> | ||
Line 45: | Line 48: | ||
<li>[[Japanese functions]]</li> | <li>[[Japanese functions]]</li> | ||
<li>[[Sir2000 Field Migration Facility]]</li> | <li>[[Sir2000 Field Migration Facility]]</li> | ||
</ul> | |||
</ul> | |||
</p> | </p> | ||
<p class="caption">Products authorizing $Lstr_SubWord | <p class="caption">Products authorizing $Lstr_SubWord | ||
</p> | </p> | ||
[[Category:$Functions|$Lstr_SubWord]] | [[Category:$Functions|$Lstr_SubWord]] |
Revision as of 14:09, 11 February 2011
<section begin="desc" />Substring of a longstring using word counts<section end="desc" />
Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no direct OO equivalent for the $Lstr_SubWord function, but the feature is supported as part of the StringTokenizer class.
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
<section begin="syntax" /> %RESULT = $Lstr_SubWord(longstring, start, words, delim) <section end="syntax" />
For example
%RES = $Lstr_SubWord('Once upon a time you dressed so fine', 3, 2)
sets %RES to "a time." and
%RES = $Lstr_SubWord('Once upon a time you dressed so fine', 3, 2, ' n')
sets %RES to "upon a"
$Lstr_SubWord is only available in Sirius Mods Version 6.5 and later.