std::to_string
From cppreference.com
< cpp | string | basic string
Defined in header <string>
|
||
std::string to_string( int value ); |
(1) | (since C++11) |
std::string to_string( long value ); |
(2) | (since C++11) |
std::string to_string( long long value ); |
(3) | (since C++11) |
std::string to_string( unsigned value ); |
(4) | (since C++11) |
std::string to_string( unsigned long value ); |
(5) | (since C++11) |
std::string to_string( unsigned long long value ); |
(6) | (since C++11) |
std::string to_string( float value ); |
(7) | (since C++11) |
std::string to_string( double value ); |
(8) | (since C++11) |
std::string to_string( long double value ); |
(9) | (since C++11) |
1-3) Converts a signed decimal integer to a string in the style [-]dddd. At least one digit is written.
4-6) Converts a unsigned decimal integer to a string in the style dddd. At least one digit is written.
7-9) Converts a floating point value to a string in the style ddd.ddd. At least 6 digits are written after the decimal point character.
Contents |
[edit] Parameters
value | - | a numeric value to convert |
[edit] Return value
a string holding the converted value
[edit] Example
double f = 23.43; std::string f_str = std::to_string(f);
[edit] See also
(C++11) |
converts an integral or floating point value to wstring (function) |