How to convert a char to its keycode?

前端 未结 5 1364
闹比i
闹比i 2020-12-09 14:26

How can I convert a character to its respective keycode?

For example:

  • a to 65
  • b to 66
5条回答
  •  伪装坚强ぢ
    2020-12-09 15:16

    Find a keycode/ascii chart like this one and put it into an array such that array['char'] = keycode. This is tedious, but the code will execute pretty fast.

提交回复
热议问题