get char value in java

后端 未结 8 1662
孤街浪徒
孤街浪徒 2020-12-18 20:04

How can I get the UTF8 code of a char in Java ? I have the char \'a\' and I want the value 97 I have the char \'é\' and I want the value 233

here is a table for more

8条回答
  •  长情又很酷
    2020-12-18 20:54

    You can create a simple loop to list all the UTF-8 characters available like this:

    public class UTF8Characters {
        public static void main(String[] args) {
            for (int i = 12; i <= 999; i++) {
                System.out.println(i +" - "+ (char)i);
            }
        }
    }
    

提交回复
热议问题