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

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;
 
原文地址:https://www.cnblogs.com/taoxu0903/p/2066506.html