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. Zero (0) 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), zero (0) will be returned.

charCodeAt was inherited from JavaScript (ES3). Use the JS++ method String.codePointAt instead. charCodeAt will not return values above 0x10000 (65536).

Examples

Basic Usage
1
2
3
4
5
6
import System;
 
string abc = "abc";
Console.log(abc.charCodeAt(0)); // 97
Console.log(abc.charCodeAt(1)); // 98
Console.log(abc.charCodeAt(2)); // 99

Share

HTML | BBCode | Direct Link