UnicodeChar (Unicode function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 2: Line 2:
[[Category:Unicode methods|UnicodeChar function]]
[[Category:Unicode methods|UnicodeChar function]]
[[Category:Intrinsic methods]]
[[Category:Intrinsic methods]]
<!--DPL?? Category:Unicode methods|UnicodeChar function: Single character at specified position of string-->
<!--DPL?? Category:Unicode methods|<var>UnicodeChar</var> function: Single character at specified position of string-->
<!--DPL?? Category:Intrinsic methods|UnicodeChar (Unicode function): Single character at specified position of string-->
<!--DPL?? Category:Intrinsic methods|<var>UnicodeChar</var> (Unicode function): Single character at specified position of string-->
<!--DPL?? Category:System methods|UnicodeChar (Unicode function): Single character at specified position of string-->
<!--DPL?? Category:System methods|<var>UnicodeChar</var> (Unicode function): Single character at specified position of string-->


This function returns the string value of the single character at a specified
This function returns the string value of the single character at a specified
position in the method object Unicode string.
position in the method object Unicode string.


The UnicodeChar function is available as of version 7.5  of the <var class=product>Sirius Mods</var>.
The <var>UnicodeChar</var> function is available as of version 7.5  of the <var class=product>Sirius Mods</var>.
==Syntax==
==Syntax==
{{Template:Unicode:UnicodeChar syntax}}
{{Template:Unicode:UnicodeChar syntax}}
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 UnicodeChar method. </td></tr>
<td>A Unicode variable to receive the result of the <var>UnicodeChar</var> method. </td></tr>
<tr><th><i>unicode</i> </th>
<tr><th><i>unicode</i> </th>
<td>A Unicode string. </td></tr>
<td>A Unicode string. </td></tr>
Line 27: Line 27:
A ''length'' value greater than the declared length
A ''length'' value greater than the declared length
of the output string results in request cancellation.
of the output string results in request cancellation.
<li>For a given position, the UnicodeChar function returns the same value as
<li>For a given position, the <var>UnicodeChar</var> function returns the same value as
the [[UnicodeSubstring (Unicode function)|UnicodeSubstring]] function with a length argument of <tt>1</tt>.
the [[UnicodeSubstring (Unicode function)|UnicodeSubstring]] function with a length argument of <tt>1</tt>.
<li>The UnicodeChar method is analogous to
<li>The <var>UnicodeChar</var> method is analogous to
the intrinsic String [[Char (String function)|Char]] function.
the intrinsic String [[Char (String function)|Char]] function.
</ul>
</ul>
===Example===
===Example===


The following request calls UnicodeChar two times:
The following request calls <var>UnicodeChar</var> two times:
<pre>
<pre>
     Begin
     Begin

Revision as of 15:32, 19 January 2011

The value at a specified position in the input string (Unicode class)

This function returns the string value of the single character at a specified position in the method object Unicode string.

The UnicodeChar function is available as of version 7.5 of the Sirius Mods.

Syntax

%outUnicode = unicode:UnicodeChar( position)

Syntax terms

%outUni A Unicode variable to receive the result of the UnicodeChar method.
unicode A Unicode string.
position The position in the method object string of the character you want to identify. A value of 1 finds the first character in the string.

Usage notes

  • The position value must be a non-negative, non-zero number; a zero or negative number results in request cancellation. A length value greater than the declared length of the output string results in request cancellation.
  • For a given position, the UnicodeChar function returns the same value as the UnicodeSubstring function with a length argument of 1.
  • The UnicodeChar method is analogous to the intrinsic String Char function.

Example

The following request calls UnicodeChar two times:

    Begin
      printText {'inaugural':unicodeChar(5)}
      %u is unicode initial('xyz&#xA1;':U
      printText {%u:unicodeChar(4)}
    End

The result is:

    g
    ?

The question mark in the result represents an EBCDIC character that is not displayable.

For further information about the above request, see descriptions of:

  • the PrintText statement
  • the instrinsic String U function