$Lstr SubWord: Difference between revisions
mNo edit summary |
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. The OO equivalent for <var>$Lstr_SubWord</var> 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 longstring input and produces a substring of the input using word counts. | ||
Line 38: | Line 38: | ||
$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> | ||
==See also== | |||
<ul> | |||
<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> | |||
<ul class="smallAndTightList"> | <ul class="smallAndTightList"> |
Revision as of 19:40, 27 April 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. 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
<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.
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