Char (String function): Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
m (1 revision) |
||
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 | 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 | ||
character array. | character array. | ||
The Char function is available as of version 7.3 of the [[Sirius Mods]]. | The Char function is available as of version 7.3 of the [[Sirius Mods]]. | ||
==Syntax== | ==Syntax== | ||
{{Template:String:Char syntax}} | {{Template:String:Char syntax}} | ||
Line 16: | Line 16: | ||
<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 string of the character you want to identify. A value of 1 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. | *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. | A ''length'' value greater than the declared length of the output string results in request cancellation. | ||
*For a given position, the Char function returns the same value as the [[Substring (String function)|Substring]] function with a length argument of ''''1''''. | *For a given position, the Char function returns the same value as the [[Substring (String function)|Substring]] function with a length argument of ''''1''''. | ||
===Example=== | ===Example=== | ||
The following statement displays the ''''s'''' character: | The following statement displays the ''''s'''' character: | ||
[[Intrinsic classes#printtext|printText]] {'Conestoga':char(5)} | [[Intrinsic classes#printtext|printText]] {'Conestoga':char(5)} | ||
===See also=== | ===See also=== | ||
[[List of intrinsic String methods]] | [[List of intrinsic String methods]] | ||
Revision as of 14:04, 19 January 2011
The value at a specified position in the input string (String class)
This 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
character array.
The Char function is available as of version 7.3 of the Sirius Mods.
Syntax
%outString = string:Char( position)
Syntax terms
%outStr | A string variable to receive the result of the Char method. |
---|---|
string | The string to which the method is applied. |
location | 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 Char function returns the same value as the Substring function with a length argument of '1'.
Example
The following statement displays the 's' character:
printText {'Conestoga':char(5)}