使用PyOpengl的时候,调用glVertex2f时,传入两个字符串会报错,所以需要将字符串转为浮点数再传,可以使用下面的方法。
>>> import string
>>> string.atoi('34')
34
>>> int('34')
34
>>> string.atof('34')
34.0
>>> float('34')
34.0...
分类:
编程语言 时间:
2014-12-01 22:35:40
阅读次数:
233
1、格式化字符串CString s;s.Format(_T("The num is %d."), i);相当于sprintf()2、转为 int转10进制最好用_ttoi(),它在 ANSI 编码系统中被编译成_atoi(),而在 Unicode 编码系统中编译成_wtoi()。用_tcstoul(...
分类:
其他好文 时间:
2014-12-01 15:48:48
阅读次数:
205
任务是判断可能出现的情况:1.空格2.空指针3.首字符是04.首字符是“+”或“-”5.判断边界条件,上界INT_MAX=2147483647,下届INT_MIN=-2147483648,小心判断 1 // 2 // main.cpp 3 // Longest Substring 4 // ...
分类:
其他好文 时间:
2014-11-30 14:07:58
阅读次数:
163
Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below a...
分类:
其他好文 时间:
2014-11-27 08:00:27
阅读次数:
319
Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, please do not see below and ...
分类:
其他好文 时间:
2014-11-26 01:20:04
阅读次数:
233
int atoi(const char *str) { long long result = 0; while (*str==' ')str++; int flag=0; if (*str == '-' || *str == '+') { flag = (*str == '-') ? -1 : 1....
分类:
其他好文 时间:
2014-11-23 15:47:53
阅读次数:
166
int StringUtil::intFromString(string data){ //NOTE atoi是非标准C函数 return atoi(data.c_str());}string StringUtil::stringFromInt(int data){ char tm...
分类:
编程语言 时间:
2014-11-21 18:18:22
阅读次数:
271
(1)字符串类型转化为整数型(Integer),还是字符串类型(String)转化为Double类型,这在java里面有非常好的内部函数,很easy的事情;
(2)但是在c里面没有Integer Double等包装类,由char[]数组转化为整数型就变得不那么简单了,atoi() itoa(...
分类:
编程语言 时间:
2014-11-20 20:17:47
阅读次数:
295
一:起因
(1)字符串类型转化为整数型(Integer),还是字符串类型(String)转化为Double类型,这在java里面有非常好的内部函数,很easy的事情;
(2)但是在c里面没有Integer Double等包装类,由char[]数组转化为整数型就变得不那么简单了,atoi() itoa()在widows下面有,但是网上说linux 下好像没有 itoa() 函数,用 sprin...
分类:
编程语言 时间:
2014-11-20 12:06:14
阅读次数:
218