Char (String function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
 
(16 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Template:String:Char subtitle}}
{{Template:String:Char subtitle}}


This [[Intrinsic classes|intrinsic]] function returns the string value of the single byte at a specified position in the method object string; it treats the object string as a
<var>Char</var> is an [[Intrinsic classes|intrinsic]] function that returns the string value of the single byte at a specified position in the method object string; it treats the object string as a
character array.
character array.


The <var>Char</var> function is available as of version 7.3 of the <var class=product>Sirius Mods</var>.
==Syntax==
==Syntax==
{{Template:String:Char syntax}}
{{Template:String:Char syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%outStr                                                                                            </th>
<tr><th>%outString</th>
<td>A string variable to receive the result of the <var>Char</var> method.                                         </td></tr>
<td>A string variable to receive the result of the <var>Char</var> method.</td></tr>
<tr><th>string                                                                                             </th>
<tr><th>string</th>
<td>The string to which the method is applied.                                                         </td></tr>
<td>The <var class="term">string</var> to which the method is applied.</td></tr>
<tr><th>location                                                                                            </th>
<tr><th>position</th>
<td>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.</td></tr>
<td>The position in the method object <var class="term">string</var> of the character you want to identify. A <var class="term">position</var> of <code>1</code> finds the first character in the string.</td></tr>
</table>
</table>


==Usage notes==
==Usage notes==
*The ''position'' value must be a non-negative, non-zero number; a zero or negative number results in request cancellation.
<ul><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 <var class="term">length</var> value greater than the declared length of the output string results in request cancellation.
A ''length'' value greater than the declared length of the output string results in request cancellation.
<li>For a given position, <var>Char</var> returns the same value as <var>[[Substring (String function)|Substring]]</var> with a length argument of <code>1</code>.
*For a given position, the <var>Char</var> function returns the same value as the [[Substring (String function)|Substring]] function with a length argument of ''''1''''.
<li><var>Char</var> is available as of <var class="product">[[Sirius Mods|Sirius Mods]]</var> version 7.3.
===Example===
</ul>
The following statement displays the ''''s'''' character:
 
    [[Intrinsic classes#printtext|printText]] {'Conestoga':char(5)}
==Example==
The following statement displays the <code>s</code> character:
<p class="code">[[PrintText statement|printText]] {'Conestoga':char(5)}
</p>


==See also==
==See also==
[[List of intrinsic String methods]]
{{Template:String:Char footer}}
 
 
[[Category:String methods|Char function]]
[[Category:Intrinsic methods]]

Latest revision as of 18:55, 2 November 2012

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


Char is an intrinsic function that returns the string value of the single byte at a specified position in the method object string; it treats the object string as a character array.

Syntax

%outString = string:Char( position)

Syntax terms

%outString A string variable to receive the result of the Char method.
string The string to which the method is applied.
position The position in the method object string of the character you want to identify. A position 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, Char returns the same value as Substring with a length argument of 1.
  • Char is available as of Sirius Mods version 7.3.

Example

The following statement displays the s character:

printText {'Conestoga':char(5)}

See also