UnicodeTrimLeft and UnicodeTrimRight (Unicode functions)

From m204wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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