double stod (const string& str, size_t* idx = 0);
double stod (const wstring& str, size_t* idx = 0);
float stof (const string& str, size_t* idx = 0);
float stof (const wstring& str, size_t* idx = 0);
int stoi (const string& str, size_t* idx = 0, int base = 10);
int stoi (const wstring& str, size_t* idx = 0, int base = 10);
long stol (const string& str, size_t* idx = 0, int base = 10);
long stol (const wstring& str, size_t* idx = 0, int base = 10);
long double stold (const string& str, size_t* idx = 0);
long double stold (const wstring& str, size_t* idx = 0);
long long stoll (const string& str, size_t* idx = 0, int base = 10);
long long stoll (const wstring& str, size_t* idx = 0, int base = 10);
unsigned long stoul (const string& str, size_t* idx = 0, int base = 10);
unsigned long stoul (const wstring& str, size_t* idx = 0, int base = 10);
unsigned long long stoull (const string& str, size_t* idx = 0, int base = 10);
unsigned long long stoull (const wstring& str, size_t* idx = 0, int base = 10);
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);
wstring to_wstring (int val);
wstring to_wstring (long val);
wstring to_wstring (long long val);
wstring to_wstring (unsigned val);
wstring to_wstring (unsigned long val);
wstring to_wstring (unsigned long long val);
wstring to_wstring (float val);
wstring to_wstring (double val);
wstring to_wstring (long double val);
解析C字符串str,将其内容解释为浮点数并将其值返回为double。
该函数首先丢弃尽可能多的空白字符(如在isspace中),直到找到第一个非空白字符。然后,从这个字符开始,根据类似于浮点文字(见下文)的语法,获取尽可能多的有效字符,并将它们解释为数值。最后一个有效字符后的其余字符串将被忽略,并且对此函数的行为没有影响。
double atof (const char* str);//Convert string to double
int atoi (const char * str);//Convert string to integer
long int atol ( const char * str );//Convert string to long integer
long long int atoll ( const char * str );//Convert string to long long integer(c++11)
解析C-string str将其内容解释为浮点数(根据当前语言环境)并将其值作为float返回。如果endptr不是空指针,则该函数还将endptr的值设置为指向数字后面的第一个字符。
该函数首先丢弃尽可能多的空白字符(如在isspace中),直到找到第一个非空白字符。然后,从这个字符开始,根据类似于浮点文字(见下文)的语法,获取尽可能多的有效字符,并将它们解释为数值。在最后一个有效字符之后指向其余字符串的指针存储在endptr指向的对象中。
使用“C”语言环境的strtof的有效浮点数由可选的符号字符(+或 - )组成,后跟以下之一:
1)一系列数字,可选地包含小数点字符(。),可选地后跟指数部分(e或E字符后跟可选符号和数字序列)。
一个0x或0X前缀,然后是一个十六进制数字序列(如在isxdigit中),可选地包含一个分隔整数和分数部分的句点。可选地后跟2指数幂(p或P字符后跟可选符号和十六进制数字序列)。
2)INF或INFINITY(忽略大小写)。
3)NAN或NANsequence(忽略大小写),其中sequence是一个字符序列,其中每个字符都是字母数字字符(如isalnum)或下划线字符(_)。
4)如果str中的第一个非空白字符序列没有形成刚刚描述的有效浮点数,或者如果由于str为空或仅包含空格字符而不存在这样的序列,则不执行转换并且函数返回0.0 F。
double strtod (const char* str, char** endptr);//Convert string to double
float strtof (const char* str, char** endptr);//Convert string to float(c++11)
long int strtol (const char* str, char** endptr, int base);//Convert string to long integer
long double strtold (const char* str, char** endptr);//Convert string to long double(c++11)
long long int strtoll (const char* str, char** endptr, int base);//Convert string to long long integer(c++11)
unsigned long int strtoul (const char* str, char** endptr, int base);//Convert string to unsigned long integer
unsigned long long int strtoull (const char* str, char** endptr, int base);//Convert string to unsigned long long integer(c++11)
char * itoa ( int value, char * str, int base );//Convert integer to string (non-standard function)
double wcstod (const wchar_t* str, wchar_t** endptr);//Convert wide string to double
float wcstof (const wchar_t* str, wchar_t** endptr);//Convert wide string to float(c++11)
wchar_t* wcstok (wchar_t* wcs, const wchar_t* delimiters);//Split wide string into tokens
long int wcstol (const wchar_t* str, wchar_t** endptr, int base);//Convert wide string to long integer
long double wcstold (const wchar_t* str, wchar_t** endptr);//Convert wide string to long double(c++11)
long long int strtoll (const wchar_t* str, wchar_t** endptr, int base);//Convert wide string to long long integer(c++11)
unsigned long int wcstoul (const wchar_t* str, wchar_t** endptr, int base);//Convert wide string to unsigned long integer
unsigned long long int wcstoull (const wchar_t* str, wchar_t** endptr, int base);//Convert wide string to unsigned long long integer(c++11)
_strtoi64, _wcstoi64, _strtoi64_l, _wcstoi64_l
_strtoui64, _wcstoui64, _strtoui64_l, _wcstoui64_l