C++ - string类型转换int类型
2014-06-08 20:16
330 查看
string类型转换int类型
本文地址: http://blog.csdn.net/caroline_wendyC语言转换形式:
...
std::string str;
int i = atoi(str.c_str());
...
C++转换形式(C++11):
...
std::string str;
int i = std::stoi(str);
...
同样, 可以使用 stol(long), stof(float), stod(double) 等.
参考: http://en.cppreference.com/w/cpp/string/basic_string/stol
相关文章推荐
- C++ int,char,string,CString类型转换 [转]
- C++ int,char,string,CString类型转换 [转]
- C++中将string类型转换为int, float, double类型 主要通过以下几种方式:
- MFC/C++/C中字符类型CString, int, string, char*之间的转换
- MFC/C++/C中字符类型CString, int, string, char*之间的转换
- string, char*, int类型转换 , c++强制转化
- string, char*, int类型转换 , c++强制转化
- c++中的一些类型转换 : CString,string,int ,long,double,char*,const char*,date等
- MFC/C++/C中字符类型CString, int, string, char*之间的转换
- c++中的一些类型转换 : CString,string,int ,long,double,char*,const char*,date
- MFC/C++/C中字符类型CString, int, string, char*之间的转换
- C++中string,char,int,double等数据类型的相互转换及与ASCII码的转换
- MFC/C++/C中字符类型CString, int, string, char*之间的转换
- C++ 中int 和string 的类型转换
- C++ int类型转换string类型
- C++ 中int,char,string,CString类型转换
- C++ 中int,char,string,CString类型转换
- MFC/C++/C中字符类型CString, int, string, char*之间的转换
- c++中的一些类型转换 : CString,string,int ,long,double,char*,const char*,date等 .
- C++ int,char,string,CString类型转换 [转]