Welcome

首页 / 软件开发 / C++ / C++中实现string类型转换int类型

C++中实现string类型转换int类型2014-11-16C语言转换形式:

...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) 等.