自己开发的博客网站,欢迎访问 www.weiboke.online
string to int
- int stoi (const string& str, size_t* idx = 0, int base = 10);
- int atoi (const char * str); (要调用std::string::c_str() 将string to const char* 才能使用函数,效率自然比上一个慢很多)
#int to string
- string to_string (int val);
- string to_string (long val);
- string to_string (long long val);
- string to_string (unsigned val);
- string to_string (unsigned long val);
- string to_string (unsigned long long val);
- string to_string (float val);
- string to_string (double val);
- string to_string (long double val);