方法1:利用自带的函数
char ch = '3'; int num = Integer.parseInt(String.valueOf(ch));
方法2:利用字符的ASCII码
char ch = '3';
int num = (int)ch - (int)'0';
ASCII码对比表参考:https://www.cnblogs.com/gslgb/p/14623806.html
方法1:利用自带的函数
char ch = '3'; int num = Integer.parseInt(String.valueOf(ch));
方法2:利用字符的ASCII码
char ch = '3';
int num = (int)ch - (int)'0';
ASCII码对比表参考:https://www.cnblogs.com/gslgb/p/14623806.html