Lintcode449-Char to Integer-Naive

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;
    }

 

posted @ 2019-04-01 11:55  IreneZh  阅读(205)  评论(0编辑  收藏  举报