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;
}
Lintcode449-Char to Integer-Naive的更多相关文章
- Java基础之引用(String,char[],Integer)总结
1.String的引用: 下列代码执行后的结果为: public class Test { public static void main(String[] args) { StringBuffer ...
- Lintcode241-String to Integer - Naive
Given a string, convert it to an integer. You may assume the string is a valid integer number that c ...
- Java基础之引用(String,char[],Integer)总结于牛客网的专项练习题
1.String的引用: 下列代码执行后的结果为: public class Test { public static void main(String[] args) { StringBuffer ...
- 对bit、byte、TByte、Char、string、进制的认识
在学校老师就教1byte = 8bit,一个Byte在内存中占8个房间.每个房间都有门牌号.找到内存中的内容就找门牌号,寻址什么的,虽然在听,但是脑袋里一头雾水,到现在只知道会用就行,但原理也不是那么 ...
- delphi char数组、string和Pchar的相互转换
因为要调用windows的api或者给vc++写接口,很多地方都要用到pchar,现在将char数组.string和pchar之间的相互转换都列出来,都是网上找的资料,我总结一下,先直接上代码,再讲原 ...
- Delphi7中的Char和XE中的Char
我用FillChar()函数时,发现两个版本中的Char不一样. 在delphi7中 procedure TForm2.Button1Click(Sender: TObject); var s: ar ...
- 【LeetCode】Reverse Integer(整数反转)
这道题是LeetCode里的第7道题. 题目描述: 给出一个 32 位的有符号整数,你需要将这个整数中每位上的数字进行反转. 示例 1: 输入: 123 输出: 321 示例 2: 输入: -123 ...
- char、pchar、string互相转换
1.string转换成pchar 可以使用pchar进行强制类型转换,也可以使用StrPCopy函数 var s:string; p,p1:PChar; begin s:='Hello Delphi' ...
- Oracle的SQL基础
1.了解SQL的种类 (1)DDL 数据定义语言:定义数据库中数据要如何存储的,包括对数据库对象的创建(create)修改(alter)删除(drop)的操作,这些对象主要有数据库,数据表,视图,索引 ...
- 转:Delphi 6 实用函数
来自: daocaoren0824, 时间: -- ::, ID: 再给你一份 程序员实用函数 {▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎} {▎ ▎} {▎ 大 ...
随机推荐
- MongoDB3.X单机及shading cluster集群的权限管理(基于3.4.5)
mongodb集群的权限管理分为两部分,一部分是最常用的Role-Based Access Control,也就是用户名密码方式,这种验证方式一般出现在单机系统,或者集群中client端连接Mongo ...
- javascript常用积累
一.JS动画与动作不一致解决: if(!$( "#handle").is(":animated")){ //判断元素是否处于动画状态 } 二.停止事件冒泡 ev ...
- 线程安全的CopyOnWriteArrayList
证明CopyOnWriteArrayList是线程安全的 先写一段代码证明CopyOnWriteArrayList确实是线程安全的. ReadThread.java import java.util. ...
- Shell for while 循环
li@ubuntu:~/test$ cat a.sh #!/bin/bash for loop in 1 2 3 4 5 do echo "The value is : $loop" ...
- RHEL7 CentOS7 的 firewall命令简单介绍
firewall 服务介绍 firewall 服务是 redhat7 和 centos7 系统默认安装好的防火墙服务,一个信任级别的概念来管理与之相关联的连接与接口.它支持 ipv4 与 ipv6,并 ...
- 基于jquery 的dateRangePicker 和 My97DatePicker
引入相应的date插件 <script type="text/javascript" src="../plugins/daterangepicker/moment. ...
- MyEclipse中项目运行时发生了Tomcat报错:[java.lang.OutOfMemoryError: PermGen space]
Tomcat内存溢出,异常信息如下: 十一月 26, 2017 1:52:26 下午 org.apache.catalina.core.ContainerBase$ContainerBackgroun ...
- Git clone 报错 Unable to negotiate with xxx.xxx.xxx.xxx port 12345: no matching cipher found. Their offer: aes128-cbc,3des-cbc,blowfish-cbc
git clone 报错 Unable to negotiate with xxx.xxx.xxx.xxx. port 12345: no matching cipher found. Their o ...
- 从技术专家到管理者的思路转变(V1)
作为技术专家出身的管理者,是一种优势(你所做的很多决策可能比非技术出身的管理者更加具有可行性和性价比).也是一种劣势(你可能会过于自恋自己的技术优势).这取决于你在接下去的职业生涯中,如何取舍你的技术 ...
- mysql 水平分表技术
这里做的是我的一个笔记. 水平分表比较简单, 理解就是: 合并的表使用的必须是MyISAM引擎 表的结构必须一致,包括索引.字段类型.引擎和字符集 数据表 user1 CREATE TABLE `us ...