Charcodeat (String.charcodeat Method) - MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

Parameters
- An integer specifying the position of a character in the string. The first
index:Number
character is indicated by
Returns
- The character at the specified index. Or an empty
String
outside the range of this
Example
In the following example, this method is called on the first letter of the string "
var my_str:String = "Chris";
var firstChar_str:String = my_str.charAt(0);
trace(firstChar_str); // output: C
See also

charCodeAt (String.charCodeAt method)

charCodeAt (String.charCodeAt method)
public charCodeAt(index:Number) : Number
Returns a 16-bit integer from 0 to 65535 that represents the character specified by
is not a number from 0 to
index
This method is similar to
character code, not a character.
Availability: ActionScript 1.0; Flash Lite 2.0
Parameters
- An integer that specifies the position of a character in the string. The first
index:Number
character is indicated by
Returns
- An integer that represents the character specified by
Number
Example
In the following example, this method is called on the first letter of the string "Chris":
var my_str:String = "Chris";
var firstChar_num:Number = my_str.charCodeAt(0);
trace(firstChar_num); // output: 67
, and the last character is indicated by
0
's indeces.
String
string.length
except that the returned value is a 16-bit integer
String.charAt()
and the last character is indicated by
0,
my_str.length-1
if the specified index is
String
- 1,
is returned.
NaN
my_str.length
.
index
.
":
Chris
. If
index
- 1.
String
629

Advertisement

Table of Contents
loading

Table of Contents