UnicodeTrimLeft and UnicodeTrimRight (Unicode functions): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (tags)
 
(One intermediate revision by the same user not shown)
Line 7: Line 7:
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%outUnicode</th><td>Is the unicode string that results from removing <var class="term">amount</var> characters from the left or right of <var class="term">unicode</var>.</td></tr>
<tr><th>%outUnicode</th><td>The <var>Unicode</var> string that results from removing <var class="term">amount</var> characters from the left or right of <var class="term">unicode</var>.</td></tr>
<tr><th>unicode</th>
<tr><th>unicode</th>
<td>The method unicode object from which characters are removed.</td></tr>
<td>The <var>Unicode</var> method object from which characters are removed.</td></tr>
<tr><th>amount</th>
<tr><th>amount</th>
<td>The number of characters to remove from the left or right of <var class="term">unicode</var>.</td></tr>
<td>The number of characters to remove from the left or right of <var class="term">unicode</var>.</td></tr>
Line 16: Line 16:
==Usage notes==
==Usage notes==
<ul>
<ul>
<li>An <var class="term">amount</var> of 0 results in the output <var vlass="term">%outunicode</var> string being set equal to the value of input <var class="term">unicode</var> object.
<li>An <var class="term">amount</var> of 0 results in the output <var class="term">%outUnicode</var> string being set equal to the value of input <var class="term">unicode</var> object.
 
<li>A negative <var class="term">amount</var> or an <var class="term">amount</var> greater than 2<sup>31</sup> results in request cancellation.
<li>A negative <var class="term">amount</var> or an <var class="term">amount</var> greater than 2<sup>31</sup> results in request cancellation.
<li>An <var class="term">amount</var> greater than or equal to the length of <var class="term">unicode</var> results in the output string being set to a null string.
<li>An <var class="term">amount</var> greater than or equal to the length of <var class="term">unicode</var> results in the output string being set to a null string.
<li><var>UnicodeTrimLeft</var> accomplishes the same thing as <var>[[UnicodeSubstring (Unicode function)|UnicodeSubString]]</var> when used with just the starting position and without a length. While it might be a little bit more efficient than <var>UnicodeSubString</var>, it's mainly available for completeness.
 
<li><var>UnicodeTrimRight</var> functionality can be achieved by using the <var>[[UnicodeLeft (Unicode function)|UnicodeLeft]]</var> and <var>[[UnicodeLength (Unicode function)|UnicodeLength]]</var> functions but it is considerably more efficient and convenient.
<li><var>UnicodeTrimLeft</var> accomplishes the same thing as <var>[[UnicodeSubstring (Unicode function)|UnicodeSubString]]</var> when used with just the starting position and without a length. While it might be a little bit more efficient than <var>UnicodeSubString</var>, it is mainly available for completeness.
 
<li><var>UnicodeTrimRight</var> functionality can be achieved by using the <var>[[UnicodeLeft (Unicode function)|UnicodeLeft]]</var> and <var>[[UnicodeLength (Unicode function)|UnicodeLength]]</var> functions, but <var>UnicodeTrimRight</var> is considerably more efficient and convenient.
</ul>
</ul>



Latest revision as of 20:15, 6 November 2012

Trim characters from left or right of string (Unicode class)

[Introduced in Sirius Mods 7.9]

UnicodeTrimLeft and UnicodeTrimRight remove a specified number of characters from the left or right end of a string.

Syntax

%outUnicode = unicode:UnicodeTrimLeft( amount)

%outUnicode = unicode:UnicodeTrimRight( amount)

Syntax terms

%outUnicodeThe Unicode string that results from removing amount characters from the left or right of unicode.
unicode The Unicode method object from which characters are removed.
amount The number of characters to remove from the left or right of unicode.

Usage notes

  • An amount of 0 results in the output %outUnicode string being set equal to the value of input unicode object.
  • A negative amount or an amount greater than 231 results in request cancellation.
  • An amount greater than or equal to the length of unicode results in the output string being set to a null string.
  • UnicodeTrimLeft accomplishes the same thing as UnicodeSubString when used with just the starting position and without a length. While it might be a little bit more efficient than UnicodeSubString, it is mainly available for completeness.
  • UnicodeTrimRight functionality can be achieved by using the UnicodeLeft and UnicodeLength functions, but UnicodeTrimRight is considerably more efficient and convenient.

Examples

See also