|
Length
Using
the length command of string, the number
of characters in a string can be obtained.
Syntax
:
string.length ;
Example
:
x = "galaxy"
trace (x.length);
The
value 6 will be displayed on the output
window.

CharcodeAt
This command returns the ASCII value of
the character specified by index. The value
will be a 16 bit integer from 0 to 65535.
Syntax
:
string.charcodeAt (index);
Example
:
x = "galaxy";
trace (x.charcodeAt(3));
The
string "x" has galaxy and the
3 position / index in the string is "a".
the ASCII value for a is 97.
The
output window will show the value 97.
CharAt
Using this command, the character in the
specified index position can be obtained.
Syntax
:
string. CharAt(index);
Example
:
x = "galaxy";
trace (x.charAt(3));
The
index value is 3 and the character in the
third position is "a" i.e. [G-0,
a-1, l-2, a-3
.]
The
character in the corresponding position
can be obtained.
Regards,
All accompanying logos,
brands and product names are trademarks
of their respective companies.
|