S > String.charCodeAt |  |

String.charCodeAt

string, string.charcodeat, charcodeat, character code at

Availability

Flash Player 5.

Usage

    myString.charCodeAt(index)

Parameters

`index` An integer that specifies the position of a character in the string. The first character is indicated by `0,` and the last character is indicated by `myString``.length-1`.

Returns

An integer.

Description

Method; returns a 16-bit integer from 0 to 65535 that represents the character specified by `index`.

This method is similar to `string`.`charAt` except that the returned value is a 16-bit integer character code, not a character.

Example

In the following example, the `charCodeAt` method is called on the first letter of the string `"Chris"`.

    s = new String("Chris");
    i = s.charCodeAt(0);
    // i = 67