首页 > 其他 > 详细

Lintcode449-Char to Integer-Naive

时间:2019-04-01 12:53:59      阅读:125      评论:0      收藏:0      [点我收藏+]

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

 

Lintcode449-Char to Integer-Naive

原文:https://www.cnblogs.com/Jessiezyr/p/10635556.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!