Java String.codePointAt(int index)
Syntax
String.codePointAt(int index) has the following syntax.
public int codePointAt(int index)
Example
In the following code shows how to use String.codePointAt(int index) method.
public class Main {
//w ww .j a v a 2 s .com
public static void main(String[] args) {
String str = "java2s.com";
System.out.println("String = " + str);
// codepoint at index 1
int retval = str.codePointAt(1);
// prints character at index1 in string
System.out.println("Character(unicode point) = " + retval);
}
}
The code above generates the following result.