charCodeAt Method
Returns an integer representing the Unicode encoding of the character at the specified location in a String object.
function charCodeAt(index : Number) : String
Arguments
- index
Required. Zero-based index of the desired character. Valid values are between 0 and the length of the string minus 1.
Remarks
The first character in a string is at index 0, the second is at index 1, and so forth.
If there is no character at the specified index, NaN is returned.
Example
The following example illustrates the use of the charCodeAt method.
function charCodeAtTest(n)
{
var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// Get the Unicode value of the character that is at position n.
var n = str.charCodeAt(n - 1);
return(n);
}
Requirements
Applies To:
See Also
Reference
Change History
Date |
History |
Reason |
---|---|---|
March 2009 |
Simplified example. |
Content bug fix. |