$Lstr Left: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Created page with "{{DISPLAYTITLE:$Lstr_Left}} <span class="pageSubtitle"><section begin="desc" />Leftmost characters of a longstring<section end="desc" /></span> <p class="warning">Most Sirius $f...")
 
(Automatically generated page update)
 
(42 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:$Lstr_Left}}
{{DISPLAYTITLE:$Lstr_Left}}
<span class="pageSubtitle"><section begin="desc" />Leftmost characters of a longstring<section end="desc" /></span>
<span class="pageSubtitle">Leftmost characters of a longstring</span>


<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Lstr_Left function is [[to be entered]].</p>
<p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Lstr_Left function is the <var>[[Left (String function)|Left]]</var> function.</p>


This function takes a string or longstring input and produces the leftmost characters of the input, possibly padded to an indicated length.  
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 <var>$Lstr_Left</var> function accepts three arguments and returns a string result.  


The first argument is an arbitrary string or longstring. This is a required argument.  
The first argument is an arbitrary string or longstring. This is a required argument.  
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_Left(longstring, len, pad)
<p class="syntax"><span class="term">%result</span> = $Lstr_Left(longstring, len, pad)
<section end="syntax" /></p>
<p class="caption">$Lstr_Left function
</p>
</p>
<p class="caption">%RESULT is the leftmost characters of the input longstring, padded with the pad character if necessary.</p>


$Lstr_Left acts very much like $PADR except
<p><var class="term">%result</var> is the leftmost characters of the input longstring, padded with the pad character if necessary.</p>
 
==Usage notes==
<ul>
<li><var>$Lstr_Left</var> acts very much like $PADR 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 28: Line 29:
<li>It can operate on LONGSTRING inputs.  
<li>It can operate on LONGSTRING inputs.  
<li>It produces a LONGSTRING output.
<li>It produces a LONGSTRING output.
</ul>
</ul>
</ul>


For example
==Examples==
<p class="code"> %BIG = $Lstr_Left('Voldemort', 3)
<ol>
<li>To set %BIG to "Vol":
<p class="code">%BIG = $Lstr_Left('Voldemort', 3)
</p>
</p>
sets %BIG to "Vol&CQ. and
 
<li>To set %BIG to "Snape" followed by 295 exclamation marks:
<p class="code"> %BIG = $Lstr_Left('Snape', 300, '!')
<p class="code"> %BIG = $Lstr_Left('Snape', 300, '!')
</p>
</p>
sets %BIG to "Snape&CQ. followed by 295 exclamation marks.
</ol>
 
For more information see :hdref refid=lstr..
 
$Lstr_Left is only available in ''[[Sirius Mods]]'' Version 6.2 and later.<p>


==Products authorizing {{PAGENAMEE}}==
<ul class="smallAndTightList">
<ul class="smallAndTightList">
<li>[[Sirius functions]]</li>
<li>[[List of $functions|Sirius functions]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Janus Open Client]]</li>
<li>[[Media:JoclrNew.pdf|Janus Open Client]]</li>
<li>[[Janus Open Server]]</li>
<li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Web Server]]</li>
<li>[[Janus Web Server]]</li>
<li>[[Japanese functions]]</li>
<li>Japanese functions</li>
<li>[[Sir2000 Field Migration Facility]]</li>
<li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li>
 
</ul>
</ul>
   
   
</p>
<p class="caption">Products authorizing $Lstr_Left
</p>
[[Category:$Functions|$Lstr_Left]]
[[Category:$Functions|$Lstr_Left]]

Latest revision as of 22:52, 20 September 2018

Leftmost characters of a longstring

Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Lstr_Left function is the Left 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

%result = $Lstr_Left(longstring, len, pad)

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

Usage notes

  • $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.

Examples

  1. To set %BIG to "Vol":

    %BIG = $Lstr_Left('Voldemort', 3)

  2. To set %BIG to "Snape" followed by 295 exclamation marks:

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

Products authorizing $Lstr_Left