$Lstr Right: Difference between revisions
m (1 revision) |
mNo edit summary |
||
Line 2: | Line 2: | ||
<span class="pageSubtitle"><section begin="desc" />Rightmost characters of a longstring<section end="desc" /></span> | <span class="pageSubtitle"><section begin="desc" />Rightmost characters of a longstring<section end="desc" /></span> | ||
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Lstr_Right function is [[ | <p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Lstr_Right function is the [[Right (String function)]].</p> | ||
This function takes a string or longstring input and produces the rightmost characters of the input, possibly padded to an indicated length. | This function takes a string or longstring input and produces the rightmost characters of the input, possibly padded to an indicated length. | ||
Line 13: | Line 13: | ||
The third argument is a string containing a single character to be used as the pad character if the result length is longer than the string specified by argument one. This is an optional argument and defaults to a blank. | The third argument is a string containing a single character to be used as the pad character if the result length is longer than the string specified by argument one. This is an optional argument and defaults to a blank. | ||
==Syntax== | ==Syntax== | ||
<p class="syntax"><section begin="syntax" /> %RESULT = $Lstr_Right(longstring, len, pad) | <p class="syntax"><section begin="syntax" /> %RESULT = $Lstr_Right(longstring, len, pad) | ||
Line 21: | Line 22: | ||
$Lstr_Right acts very much like $PAD except | $Lstr_Right acts very much like $PAD except | ||
<ul> | <ul> | ||
<li>The target length and pad character arguments are reversed. | <li>The target length and pad character arguments are reversed. | ||
<li>It cancels the request if the result target is too short to hold the result. | <li>It cancels the request if the result target is too short to hold the result. | ||
Line 33: | Line 34: | ||
<p class="code"> %BIG = $Lstr_Right('McGonagall', 3) | <p class="code"> %BIG = $Lstr_Right('McGonagall', 3) | ||
</p> | </p> | ||
sets %BIG to "all&CQ. and | sets %BIG to "all&CQ. and | ||
<p class="code"> %BIG = $Lstr_Right('Dumbledore', 300, '?') | <p class="code"> %BIG = $Lstr_Right('Dumbledore', 300, '?') | ||
</p> | </p> | ||
sets %BIG to 290 question marks followed by "Dumbledore&CQ.. | sets %BIG to 290 question marks followed by "Dumbledore&CQ.. | ||
$Lstr_Right is only available in ''[[Sirius Mods]]'' Version 6.2 and later.<p> | $Lstr_Right is only available in ''[[Sirius Mods]]'' Version 6.2 and later.<p> | ||
Line 57: | Line 59: | ||
<p class="caption">Products authorizing $Lstr_Right | <p class="caption">Products authorizing $Lstr_Right | ||
</p> | </p> | ||
[[Category:$Functions|$Lstr_Right]] | [[Category:$Functions|$Lstr_Right]] |
Revision as of 22:47, 10 February 2011
<section begin="desc" />Rightmost characters of a longstring<section end="desc" />
Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Lstr_Right function is the Right (String function).
This function takes a string or longstring input and produces the rightmost characters of the input, possibly padded to an indicated length.
The $Lstr_Right function accepts three arguments and returns a 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 result length. This is a required argument.
The third argument is a string containing a single character to be used as the pad character if the result length is longer than the string specified by argument one. This is an optional argument and defaults to a blank.
Syntax
<section begin="syntax" /> %RESULT = $Lstr_Right(longstring, len, pad) <section end="syntax" />
$Lstr_Right acts very much like $PAD except
- The target length and pad character arguments are reversed.
- It cancels the request if the result target is too short to hold the result.
- It cancels the request if the pad character argument is longer than one byte.
- It can operate on LONGSTRING inputs.
- It produces a LONGSTRING output.
For example
%BIG = $Lstr_Right('McGonagall', 3)
sets %BIG to "all&CQ. and
%BIG = $Lstr_Right('Dumbledore', 300, '?')
sets %BIG to 290 question marks followed by "Dumbledore&CQ..
$Lstr_Right is only available in Sirius Mods Version 6.2 and later.