String.charCodeAt( ) Method

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
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



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net