Table of Contents

String.charCodeAt( ) Method Flash 5

retrieve the code point of the character at a specific position in a string
string.charCodeAt(index)

Arguments

index

The integer position of a character in string, which should be in the range of 0 (the first character) to string.length - 1 (the last character).

Returns

An integer representing the Unicode code point of the character in the position index within string. For the code points of the first 256 characters, see Appendix B.

Example

var msg = "A is the first letter of the Latin alphabet.";
trace(msg.charCodeAt(0));  // Displays: 65 (the code point for the "A" character)
trace(msg.charCodeAt(1));  // Displays: 32 (the code point for the space character)

See Also

String.charAt( ), String.fromCharCode( ); "The charCodeAt( ) function," in Chapter 4; Appendix B


Table of Contents