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: 再给你一份 程序员实用函数 {▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎} {▎ ▎} {▎ 大 ...
随机推荐
- 以太坊ETH中智能合约消耗的Gas、Gas Limit是什么?
以太坊ETH中智能合约消耗的Gas.Gas Limit是什么? 数字货币交易一般是有交易费的,比特币(BTC)的交易费很容易理解,就是直接支付一定额度的BTC作为手续费.而以太坊(ETH)的交易费表面 ...
- max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
elasticsearch安装时遇到的错误 问题翻译过来就是:elasticsearch用户拥有的可创建文件描述的权限太低,至少需要65536: 解决办法: #切换到root用户修改 vim /etc ...
- Poj3253 Fence Repair (优先队列)
Fence Repair Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 67319 Accepted: 22142 De ...
- Installing Android Studio
To set up Android Studio on Windows: Launch the .exe file you just downloaded. Follow the setup wiza ...
- 服务器网络地址 "TCP://XXX:5022" 无法访问或不存在。请检查网络地址
把主机上数据库,完整备份一份库文件和事务日志文件,“with non recover”方式还原过去,再重新执行SQL指令.当跨IP段的时候就需要在主备机的 C:\Windows\System32\dr ...
- 三张图搞懂JavaScript的原型对象与原型链 / js继承,各种继承的优缺点(原型链继承,组合继承,寄生组合继承)
摘自:https://www.cnblogs.com/shuiyi/p/5305435.html 对于新人来说,JavaScript的原型是一个很让人头疼的事情,一来prototype容易与__pro ...
- Linux 配置 JDK
1. 上传 JDK 2. 解压文件 tar -xvf 文件名 3. 配置环境变量: 指令 vim /etc/profile 以上格式是不变的,使用时只改变 JAVA_HOME 和 JAVA_BIN 的 ...
- Qt发布可执行程序
在Qt Creator下用release跑一遍程序,生成相应的EXE文件. 在Qt Creator下编译好的release下的 youProgramName.exe 拷贝到一个文件夹下面: 在 ...
- EditPlus配置GTK
--GCC GTK Compile-- 命令:D:\GCC\MinGW_RP_Green\bin\gcc.exe 参数:$(FileName) -w -o $(FileNameNoExt).exe - ...
- ManyToManyField 增加记录
class BOMView(View): def get(self,request): obj=BOMForm() return render(request,'bom.html',{'obj':ob ...