您的位置:首页 > 其它

[tip]convert string to digit (int, double)

2011-06-01 16:02 399 查看
We are used to convert string to int/double by CRT provided functions, 数值和字符串相互转换(C++ 数据类型转换技巧)

Actually STL provides more graceful way to do this kind of conversion by istringstream / wistringstream:

#include<sstream>

using namespace std;

double dVal = 0;

wistringstream wstrStream(str);

wstrStream >> dVal;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: