Char (String function): Difference between revisions
Jump to navigation
Jump to search
m (first pass, match syntax diagram to template and fix tags) |
m (re-match syntax diagram to revised template; fix tags.) |
||
Line 8: | Line 8: | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><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 | <tr><th>string</th> | ||
<td>The <var class="term">string</var> 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>position</th> | <tr><th>position</th> | ||
Line 28: | Line 28: | ||
==See also== | ==See also== | ||
<ul><li>For details of the <var>printtext</var> statement, please see <var>[[Intrinsic classes#printtext|printText]]</var></ul> | |||
{{Template:String:Char footer}} | {{Template:String:Char footer}} |
Revision as of 02:47, 2 February 2011
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
- For details of the printtext statement, please see printText