The String class facilitates finding the unicode of characters in a String using the codePointAt method.
Listing 1. Finding Unicode Characters
public class StringCodePoint
{
public static void main(String args[])
{
StringCodePoint stringCodePoint = new StringCodePoint();
stringCodePoint.proceed();
}
private void proceed()
{
String name = "ABC"; //Defining a String with value ABC
System.out.println("CodePoint of A : " + name.codePointAt(0)); //0 is the starting index
}
}
/*
Expected output:
[root@mypc]# java StringCodePoint
CodePoint of A : 65
*/