Get the Ascii code of a character in Java
/**
* @author lautturi.com
* Java example: get ascii code in java
*/
import java.util.*;
public class Lautturi {
public static void main(String[] args) {
String str = "hello lautturi world!";
int codePointAt0 = Character.codePointAt(str, 0);
System.out.println(codePointAt0);
}
}Sourw:ecww.lautturi.comoutput:
The ascii code of h is 104:
104