Get unicode value of character

后端 未结 4 1126
轻奢々
轻奢々 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:46

    A way is this:

    char c = 'f';

    System.out.println("code="+(int)c);

    I mean, you should make a casting form char to int;

提交回复
热议问题