架构理念:[简单][高效][可依赖] 管理理念:[价值][勇气][专注]

c++ * to string and string to *

#include <sstream>

string ltos(long l)
{
ostringstream os;
os << l;
string result;
istringstream is(os.str());
is >> result;
return result;
}


long stol(string str)
{
long result;
istringstream is(str);
is >> result;
return result;
}

 

std::to_string
 unsigned long ul = std::stoul (str,nullptr,0);

 

posted @ 2020-12-26 17:16  文和-Mignet  阅读(98)  评论(0编辑  收藏  举报