charCodeAt Summary Gets the Unicode value of a character at a given position. Usage public unsigned short+ charCodeAt(int index) Returns The Unicode value for the character. undefined is returned if the index is out of range. Parameters index The position of the character. Description Gets the Unicode value of a character at a given position. If the index is out of range (e.g. negative number or greater than the length of the string), undefined will be returned. charCodeAt was inherited from JavaScript (ES3). Use the JS++ method String.codePointAt instead. charCodeAt will not return values above 0x10000 (65536). Performance This method uses existent types for safety, which requires runtime bounds checking. In browser environments, where performance is critical, consider casting the string to external before calling charCodeAt on it. In other environments, casting to external may not provide a discernable performance improvement, and it may even decrease performance. Examples Basic Usage 123456import System; string abc = "abc";Console.log(abc.charCodeAt(0)); // 97Console.log(abc.charCodeAt(1)); // 98Console.log(abc.charCodeAt(2)); // 99 Share HTML | BBCode | Direct Link