作者热门文章
- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
Possible Duplicate:
How to parse a string to an int in C++?
如何将 C++ 字符串转换为 int?
假设您希望字符串中包含实际数字(例如,“1”、“345”、“38944”)。
另外,假设你没有 boost,你真的想用 C++ 的方式,而不是笨拙的旧 C 方式。
最佳答案
#include <sstream>
// st is input string
int result;
stringstream(st) >> result;
关于c++ - 如何将 C++ 字符串转换为 int?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/200090/
我是一名优秀的程序员,十分优秀!