Get unicode value of character

后端 未结 4 1187
轻奢々
轻奢々 2020-12-20 01:09

Is there any way to get the keycode of a char? For example

getKeycode(\'C\');

Is there anything like that?

Thanks

4条回答
  •  长情又很酷
    2020-12-20 01:39

    char ch='c';
    int code = ch;
    System.out.println(code);
    

    OUTPUT:

    99
    

    just for escape char \ you have to use like char ch='\\';

提交回复
热议问题