Class: String
Description
This method returns the ASCII code of the character at the specified position of the string, or -1 if the specified position is greater than String.length() or less than 1.
Syntax
StringObject.ascii(Number position)
Parameters
position |
The position of the character. The default value is 1. |
Returns
An integer number between 0 and 255.
When Became Available
v7.0
Example
// One string, 4 cases
type String STR = "Just a 'String'!"
type Number N1 = STR.ascii() // 74 (J)
type Number N2 = STR.ascii(8) // 39 (')
type Number N3 = STR.ascii(99) // -1 (too big)
type Number N4 = STR.ascii(0) // -1 (too small)