Char (String function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (printtext)
m (printtext)
Line 19: Line 19:
<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.
<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.
<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>.
<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>.
<li><var>Char</var> is available as of <var class="product">[[Sirius Mods|"Sirius Mods"]]</var> version 7.3.
<li><var>Char</var> is available as of <var class="product">[[Sirius Mods|Sirius Mods]]</var> version 7.3.
</ul>  
</ul>  



Revision as of 17:46, 4 May 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

  1. The following statement displays the s character:

    printText {'Conestoga':char(5)}

See also