Description
Convert a char to an integer. You can assume the char is in ASCII code (See Definition, so the value of the char should be in 0~255.
Example
Example 1:
Input: 'a'
Output: 97
Explanation:
return the number of the char in ASCII.
Example 2:
Input: '%'
Output: 37
Explanation:
return the number of the char in ASCII.
注意:
char 转 int, 打印出来是char对应的ASCII [如 char m = 'a'; int n = (int) m; 输出 n = 97;]
代码:
public int charToInteger(char character) { return (int) character; }