C++ string to int && int to string [自己开发的博客网站,欢迎访问](www.weiboke.online) www.weiboke.online

自己开发的博客网站,欢迎访问 www.weiboke.online

string to int

  1. int stoi (const string& str, size_t* idx = 0, int base = 10);
  2. int atoi (const char * str); (要调用std::string::c_str() 将string to const char* 才能使用函数,效率自然比上一个慢很多)

#int to string

  1. string to_string (int val);
  2. string to_string (long val);
  3. string to_string (long long val);
  4. string to_string (unsigned val);
  5. string to_string (unsigned long val);
  6. string to_string (unsigned long long val);
  7. string to_string (float val);
  8. string to_string (double val);
  9. string to_string (long double val);

你可能感兴趣的:(C++ string to int && int to string [自己开发的博客网站,欢迎访问](www.weiboke.online) www.weiboke.online)