$Lstr Left: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 43: Line 43:
sets %BIG to "Snape" followed by 295 exclamation marks.  
sets %BIG to "Snape" followed by 295 exclamation marks.  


$Lstr_Left is only available in ''[[Sirius Mods]]'' Version 6.2 and later.<p>
$Lstr_Left is only available in <var class="product">[[Sirius Mods]]</var> Version 6.2 and later.<p>


<ul class="smallAndTightList">
<ul class="smallAndTightList">

Revision as of 22:05, 16 June 2012

Leftmost characters of a longstring

Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Lstr_Left function is the Left (String function).

This function takes a string or longstring input and produces the leftmost characters of the input, possibly padded to an indicated length.

The $Lstr_Left 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_Left(longstring, len, pad) <section end="syntax" />

$Lstr_Left function

%RESULT is the leftmost characters of the input longstring, padded with the pad character if necessary.

$Lstr_Left acts very much like $PADR 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_Left('Voldemort', 3)

sets %BIG to "Vol". and

%BIG = $Lstr_Left('Snape', 300, '!')

sets %BIG to "Snape" followed by 295 exclamation marks.

$Lstr_Left is only available in Sirius Mods Version 6.2 and later.

Products authorizing $Lstr_Left