UnicodeLeft (Unicode function): Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
m (1 revision) |
||
Line 2: | Line 2: | ||
[[Category:Unicode methods|UnicodeLeft function]] | [[Category:Unicode methods|UnicodeLeft function]] | ||
[[Category:Intrinsic methods]] | [[Category:Intrinsic methods]] | ||
<!--DPL?? Category:Unicode methods|<var>UnicodeLeft</var> function: Left-most characters of string to specified length--> | <!--DPL?? Category:<var>Unicode</var> methods|<var>UnicodeLeft</var> function: Left-most characters of string to specified length--> | ||
<!--DPL?? Category:Intrinsic methods|<var>UnicodeLeft</var> (Unicode function): Left-most characters of string to specified length--> | <!--DPL?? Category:Intrinsic methods|<var>UnicodeLeft</var> (<var>Unicode</var> function): Left-most characters of string to specified length--> | ||
<!--DPL?? Category:System methods|<var>UnicodeLeft</var> (Unicode function): Left-most characters of string to specified length--> | <!--DPL?? Category:<var>System</var> methods|<var>UnicodeLeft</var> (<var>Unicode</var> function): Left-most characters of string to specified length--> | ||
This function returns the left-most characters of the method object string, | This function returns the left-most characters of the method object string, | ||
Line 15: | Line 15: | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th><i>%outUni</i></th> | <tr><th><i>%outUni</i></th> | ||
<td>A Unicode variable to receive the result of the <var>UnicodeLeft</var> method. </td></tr> | <td>A <var>Unicode</var> variable to receive the result of the <var>UnicodeLeft</var> method. </td></tr> | ||
<tr><th><i>unicode</i></th> | <tr><th><i>unicode</i></th> | ||
<td>A Unicode string. </td></tr> | <td>A <var>Unicode</var> string. </td></tr> | ||
<tr><th><i>length</i></th> | <tr><th><i>length</i></th> | ||
<td>The number of the left-most characters to return. If the method object is shorter than the requested number of characters, it is either padded to the requested length or the entire method object string is returned with no padding, depending on the value of the Pad parameter. </td></tr> | <td>The number of the left-most characters to return. If the method object is shorter than the requested number of characters, it is either padded to the requested length or the entire method object string is returned with no padding, depending on the value of the Pad parameter. </td></tr> | ||
Line 29: | Line 29: | ||
<li>The pad parameter value must be either null or a single character. | <li>The pad parameter value must be either null or a single character. | ||
A longer value results in a compilation error. | A longer value results in a compilation error. | ||
<li>The <var>UnicodeLeft</var> method is identical to the | <li>The <var>UnicodeLeft</var> method is identical to the <var>Unicode</var>Substring method | ||
(??[[UnicodeSubstring (Unicode function)|UnicodeSubstring]]) with a 1 for the first argument. | (??[[UnicodeSubstring (Unicode function)|UnicodeSubstring]]) with a 1 for the first argument. | ||
<li>The <var>UnicodeLeft</var> method is analogous to | <li>The <var>UnicodeLeft</var> method is analogous to | ||
the String intrinsic Left method (??[[Left (String function)|Left]]). | the <var>String</var> intrinsic Left method (??[[Left (String function)|Left]]). | ||
</ul> | </ul> | ||
==Examples== | ==Examples== | ||
Line 47: | Line 47: | ||
The following statement gets a character translation exception | The following statement gets a character translation exception | ||
because the Unicode character <tt>&#x2122;</tt> (trademark) has no | because the <var>Unicode</var> character <tt>&#x2122;</tt> (trademark) has no | ||
Ebcdic equivalent: | Ebcdic equivalent: | ||
<pre> | <pre> |
Revision as of 15:49, 20 January 2011
The left-most characters of the string (Unicode class)
This function returns the left-most characters of the method object string, possibly padding it on the right.
The UnicodeLeft function is available as of version 7.5 of the Sirius Mods.
Syntax
%outUnicode = unicode:UnicodeLeft( number, [Pad= c])
Syntax terms
%outUni | A Unicode variable to receive the result of the UnicodeLeft method. |
---|---|
unicode | A Unicode string. |
length | The number of the left-most characters to return. If the method object is shorter than the requested number of characters, it is either padded to the requested length or the entire method object string is returned with no padding, depending on the value of the Pad parameter. |
Pad=char | The character used to pad the method object string on the right if it is shorter than the requested length. char defaults to a null, which means no padding is done. Pad is a name-required parameter. |
Usage notes
- The length value must be a non-negative number. A negative number results in request cancellation.
- The pad parameter value must be either null or a single character. A longer value results in a compilation error.
- The UnicodeLeft method is identical to the UnicodeSubstring method (??UnicodeSubstring) with a 1 for the first argument.
- The UnicodeLeft method is analogous to the String intrinsic Left method (??Left).
Examples
The following statement displays Model 2:
%u is unicode initial('Model 204™':U) printText {%u:unicodeLeft(7)}
The following statement displays Model 204!!!:
%u is unicode initial('Model 204') printText {%u:unicodeLeft(12, pad='!')}
The following statement gets a character translation exception because the Unicode character ™ (trademark) has no Ebcdic equivalent:
%u is unicode initial('Model 204™':U) printText {%u:unicodeLeft(10)}