std::to_string
From Cppreference
< cpp | string | basic string
Defined in header <string>
|
||
std::string to_string( int value );
|
(1) | (C++11 feature) |
std::string to_string( long value );
|
(2) | (C++11 feature) |
std::string to_string( long long value );
|
(3) | (C++11 feature) |
std::string to_string( unsigned value );
|
(4) | (C++11 feature) |
std::string to_string( unsigned long value );
|
(5) | (C++11 feature) |
std::string to_string( unsigned long long value );
|
(6) | (C++11 feature) |
std::string to_string( float value );
|
(7) | (C++11 feature) |
std::string to_string( double value );
|
(8) | (C++11 feature) |
std::string to_string( long double value );
|
(9) | (C++11 feature) |
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
|
converts an integral or floating point value to wstring (function) |