C++ 字符串 与 整数、浮点数的相互转换
整数、浮点数转字符串
std::to_string
定义于头文件
<string> |
||
std::string to_string( int value );
|
(1) | (C++11 起) |
std::string to_string( long value );
|
(2) | (C++11 起) |
std::string to_string( long long value );
|
(3) | (C++11 起) |
std::string to_string( unsigned value );
|
(4) | (C++11 起) |
std::string to_string( unsigned long value );
|
(5) | (C++11 起) |
std::string to_string( unsigned long long value );
|
(6) | (C++11 起) |
std::string to_string( float value );
|
(7) | (C++11 起) |
std::string to_string( double value );
|
(8) | (C++11 起) |
std::string to_string( long double value );
|
(9) | (C++11 起) |
定义于头文件 <string>
(C++11)(C++11)
|
转换字符串为无符号整数 (函数) |
(C++11)(C++11)(C++11)
|
转换字符串为有符号整数 (函数) |
(C++11)(C++11)(C++11)
|
转换字符串为浮点值 (函数) |