UnicodeChar (Unicode function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Created page with "<span style="font-size:120%; color:black"><b>Single character at specified position of string</b></span> UnicodeChar function [[Category:In...")
 
 
(50 intermediate revisions by 8 users not shown)
Line 1: Line 1:
<span style="font-size:120%; color:black"><b>Single character at specified position of string</b></span>
{{Template:Unicode:UnicodeChar subtitle}}
[[Category:Intrinsic Unicode methods|UnicodeChar function]]
[[Category:Intrinsic methods]]
[[Category:System methods]]
<!--DPL?? Category:Intrinsic Unicode methods|UnicodeChar function: Single character at specified position of string-->
<!--DPL?? Category:Intrinsic methods|UnicodeChar (Unicode function): Single character at specified position of string-->
<!--DPL?? Category:System methods|UnicodeChar (Unicode function): Single character at specified position of string-->


This function returns the string value of the single character at a specified
<var>UnicodeChar</var> returns the string value of the single character at a specified position in the method object <var>Unicode</var> string.
position in the method object Unicode string.


The UnicodeChar function is available as of version 7.5  of the ''Sirius Mods''.
==Syntax==
===Syntax===
{{Template:Unicode:UnicodeChar syntax}}
  %outUni = unicode:UnicodeChar(position)
===Syntax terms===
====Syntax Terms====
<table class="syntaxTable">
<dl>
<tr><th>%outUnicode</th>
<dt><i>%outUni</i>
<td>A <var>Unicode</var> variable to receive the result of the <var>UnicodeChar</var> method.</td></tr>
<dd>A Unicode variable to receive the result of the UnicodeChar method.
<tr><th>unicode</th>
<dt><i>unicode</i>
<td>A <var>Unicode</var> string.</td></tr>
<dd>A Unicode string.
<tr><th>position</th>
<dt><i>position</i>
<td>The position in the method object string, <var class="term">unicode</var>, of the character you want to identify. A value of 1 finds the first character in the string.</td></tr>
<dd>The position in the method object string of the character you want
</table>
to identify.
A value of 1 finds the first character in the string.


</dl>
==Usage notes==
===Usage Notes===
<ul>
<ul>
<li>The ''position'' value must be a non-negative, non-zero number;
<li>The <var class="term">position</var> value must be a non-negative, non-zero number; a zero or negative number results in request cancellation; a value greater than the declared length of the output string results in request cancellation.
a zero or negative number results in request cancellation.
<li>For a given <var class="term">position</var>, the <var>UnicodeChar</var> function returns the same value as <var>[[UnicodeSubstring (Unicode function)|UnicodeSubstring]]</var> with a length argument of <code>1</code>.
A ''length'' value greater than the declared length
<li>The <var>UnicodeChar</var> method is analogous to the intrinsic <var>String</var> <var>[[Char (String function)|Char]]</var> function.
of the output string results in request cancellation.
<li><var>UnicodeChar</var> is available as of <var class="product">Sirius Mods</var> Version 7.5.
<li>For a given position, the UnicodeChar function returns the same value as
the UnicodeSubstring function (described ??[[UnicodeSubstring (Unicode function)|UnicodeSubstring]])
with a length argument of <tt>1</tt>.
<li>The UnicodeChar method is analogous to
the String intrinsic Char method (??[[Char (String function)|Char]]).
</ul>
</ul>
===Example===


The following request calls UnicodeChar two times:
==Example==
<pre>
The following request calls <var>UnicodeChar</var> two times:
    Begin
<p class="code">begin
      printText {'inaugural':unicodeChar(5)}
  [[PrintText statement|printText]] {'inaugural':unicodeChar(5)}
      %u is unicode initial('xyz&amp;#xA1;':U)
  %u is unicode initial('xyz&amp;#xA1;':[[U (String function)|U]])
      printText {%u:unicodeChar(4)}
  printText {%u:unicodeChar(4)}
    End
end
</pre>
</p>


The result is:
The result is:
<pre>
<p class="output">g
    g
?
    ?
</p>
</pre>


The question mark in the result represents an EBCDIC character that
The question mark in the result represents an EBCDIC character that is not displayable.
is not displayable.
 
The U constant function used in the example is described ??[[U (String function)|U]].
==See also==
For information about the PrintText statement, see the list item [[??]] refid=intprnt..
<ul>
<li><var>[[U (String function)]]</var>
</ul>
 
{{Template:Unicode:UnicodeChar footer}}

Latest revision as of 17:04, 6 November 2012

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


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

Syntax

%outUnicode = unicode:UnicodeChar( position)

Syntax terms

%outUnicode A Unicode variable to receive the result of the UnicodeChar method.
unicode A Unicode string.
position The position in the method object string, unicode, 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 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 UnicodeSubstring with a length argument of 1.
  • The UnicodeChar method is analogous to the intrinsic String Char function.
  • UnicodeChar is available as of Sirius Mods Version 7.5.

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.

See also