std::to_string
Aus cppreference.com
< cpp | string | basic string
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
definiert in Header <string>
|
||
std::string to_string( int value ); |
(1) | (seit C++11) |
std::string to_string( long value ); |
(2) | (seit C++11) |
std::string to_string( long long value ); |
(3) | (seit C++11) |
std::string to_string( unsigned value ); |
(4) | (seit C++11) |
std::string to_string( unsigned long value ); |
(5) | (seit C++11) |
std::string to_string( unsigned long long value ); |
(6) | (seit C++11) |
std::string to_string( float value ); |
(7) | (seit C++11) |
std::string to_string( double value ); |
(8) | (seit C++11) |
std::string to_string( long double value ); |
(9) | (seit C++11) |
1)
Konvertiert eine vorzeichenbehaftete Dezimalzahl in einen String mit dem gleichen Inhalt wie das, was std::sprintf(buf, "%d", value) würde für hinreichend große
buf
produzieren .Original:
Converts a signed decimal integer to a string with the same content as what std::sprintf(buf, "%d", value) would produce for sufficiently large
buf
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
2)
Konvertiert eine vorzeichenbehaftete Dezimalzahl in einen String mit dem gleichen Inhalt wie das, was std::sprintf(buf, "%ld", value) würde für hinreichend große
buf
produzieren ..Original:
Converts a signed decimal integer to a string with the same content as what std::sprintf(buf, "%ld", value) would produce for sufficiently large
buf
..The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
3)
Konvertiert eine vorzeichenbehaftete Dezimalzahl in einen String mit dem gleichen Inhalt wie das, was std::sprintf(buf, "%lld", value) würde für hinreichend große
buf
produzieren .Original:
Converts a signed decimal integer to a string with the same content as what std::sprintf(buf, "%lld", value) would produce for sufficiently large
buf
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
4)
Konvertiert eine vorzeichenlose Dezimalzahl in einen String mit dem gleichen Inhalt wie das, was std::sprintf(buf, "%u", value) würde für hinreichend große
buf
produzieren .Original:
Converts an unsigned decimal integer to a string with the same content as what std::sprintf(buf, "%u", value) would produce for sufficiently large
buf
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
5)
Konvertiert eine vorzeichenlose Dezimalzahl in einen String mit dem gleichen Inhalt wie das, was std::sprintf(buf, "%lu", value) würde für hinreichend große
buf
produzieren .Original:
Converts an unsigned decimal integer to a string with the same content as what std::sprintf(buf, "%lu", value) would produce for sufficiently large
buf
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
6)
Konvertiert eine vorzeichenlose Dezimalzahl in einen String mit dem gleichen Inhalt wie das, was std::sprintf(buf, "%llu", value) würde für hinreichend große
buf
produzieren .Original:
Converts an unsigned decimal integer to a string with the same content as what std::sprintf(buf, "%llu", value) would produce for sufficiently large
buf
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
7,8 )
Wandelt eine Fließkommazahl in einen String mit dem gleichen Inhalt wie das, was std::sprintf(buf, "%f", value) würde für hinreichend große
buf
produzieren .Original:
Converts a floating point value to a string with the same content as what std::sprintf(buf, "%f", value) would produce for sufficiently large
buf
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
9)
Wandelt eine Fließkommazahl in einen String mit dem gleichen Inhalt wie das, was std::sprintf(buf, "%Lf", value) würde für hinreichend große
buf
produzieren .Original:
Converts a floating point value to a string with the same content as what std::sprintf(buf, "%Lf", value) would produce for sufficiently large
buf
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Inhaltsverzeichnis |
[Bearbeiten] Parameter
value | - | ein numerischer Wert zu konvertieren
Original: a numeric value to convert The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[Bearbeiten] Rückgabewert
eine Zeichenkette den umgerechneten Wert
Original:
a string holding the converted value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten] Beispiel
#include <iostream> #include <string> int main() { double f = 23.43; std::string f_str = std::to_string(f); std::cout << f_str << '\n'; }
Output:
23.430000
[Bearbeiten] Siehe auch
(C++11) |
wandelt ein integrierter oder Gleitkommawert wstring Original: converts an integral or floating point value to wstring The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktion) |