cpp/string/basic string/to string: differenze tra le versioni
Da cppreference.com.
< cpp | string | basic string
m (r2.7.3) (Bot: Aggiungo de, en, es, fr, ja, pt, ru, zh) |
m (Use {{lc}}. Update links. Various fixes.) |
||
Riga 2: | Riga 2: | ||
{{cpp/title|to_string}} | {{cpp/title|to_string}} | ||
{{cpp/string/basic_string/navbar}} | {{cpp/string/basic_string/navbar}} | ||
− | {{ | + | {{begin}} |
− | {{ | + | {{header | string}} |
− | {{ | + | {{| num=1 | =c++11 | |
std::string to_string( int value ); | std::string to_string( int value ); | ||
}} | }} | ||
− | {{ | + | {{| num=2 | sincec++11 | |
std::string to_string( long value ); | std::string to_string( long value ); | ||
}} | }} | ||
− | {{ | + | {{| num=3 | sincec++11 | |
std::string to_string( long long value ); | std::string to_string( long long value ); | ||
}} | }} | ||
− | {{ | + | {{| num=4 | sincec++11 | |
std::string to_string( unsigned value ); | std::string to_string( unsigned value ); | ||
}} | }} | ||
− | {{ | + | {{| num=5 | sincec++11 | |
std::string to_string( unsigned long value ); | std::string to_string( unsigned long value ); | ||
}} | }} | ||
− | {{ | + | {{| num=6 | sincec++11 | |
std::string to_string( unsigned long long value ); | std::string to_string( unsigned long long value ); | ||
}} | }} | ||
− | {{ | + | {{| num=7 | sincec++11 | |
std::string to_string( float value ); | std::string to_string( float value ); | ||
}} | }} | ||
− | {{ | + | {{| num=8 | sincec++11 | |
std::string to_string( double value ); | std::string to_string( double value ); | ||
}} | }} | ||
− | {{ | + | {{| num=9 | sincec++11 | |
std::string to_string( long double value ); | std::string to_string( long double value ); | ||
}} | }} | ||
− | {{ | + | {{end}} |
@1@ {{tr|Converte un numero intero decimale con segno in una stringa con il contenuto stesso di quello che {{c|std::sprintf(buf, "%d", value)}} produrrebbe per {{tt|buf}} sufficientemente grande.|Converts a signed decimal integer to a string with the same content as what {{c|std::sprintf(buf, "%d", value)}} would produce for sufficiently large {{tt|buf}}.}} | @1@ {{tr|Converte un numero intero decimale con segno in una stringa con il contenuto stesso di quello che {{c|std::sprintf(buf, "%d", value)}} produrrebbe per {{tt|buf}} sufficientemente grande.|Converts a signed decimal integer to a string with the same content as what {{c|std::sprintf(buf, "%d", value)}} would produce for sufficiently large {{tt|buf}}.}} | ||
Riga 43: | Riga 43: | ||
===Parametri=== | ===Parametri=== | ||
− | {{ | + | {{begin}} |
− | {{ | + | {{| value |{{tr| un valore numerico da convertire| a numeric value to convert}}}} |
− | {{ | + | {{end}} |
===Valore di ritorno=== | ===Valore di ritorno=== | ||
Riga 67: | Riga 67: | ||
===Vedi anche=== | ===Vedi anche=== | ||
− | {{ | + | {{begin}} |
− | {{ | + | {{| cpp/string/basic_string/to_wstring}} |
− | {{ | + | {{end}} |
[[de:cpp/string/basic string/to string]] | [[de:cpp/string/basic string/to string]] |
Versione delle 15:11, 2 lug 2013
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
Elemento definito nell'header <string>
|
||
std::string to_string( int value ); |
(1) | (dal C++11) |
std::string to_string( long value ); |
(2) | (dal C++11) |
std::string to_string( long long value ); |
(3) | (dal C++11) |
std::string to_string( unsigned value ); |
(4) | (dal C++11) |
std::string to_string( unsigned long value ); |
(5) | (dal C++11) |
std::string to_string( unsigned long long value ); |
(6) | (dal C++11) |
std::string to_string( float value ); |
(7) | (dal C++11) |
std::string to_string( double value ); |
(8) | (dal C++11) |
std::string to_string( long double value ); |
(9) | (dal C++11) |
1)
Converte un numero intero decimale con segno in una stringa con il contenuto stesso di quello che std::sprintf(buf, "%d", value) produrrebbe per
buf
sufficientemente grande.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)
Converte un numero intero decimale con segno in una stringa con il contenuto stesso di quello che std::sprintf(buf, "%ld", value) produrrebbe per
buf
sufficientemente grande..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)
Converte un numero intero decimale con segno in una stringa con il contenuto stesso di quello che std::sprintf(buf, "%lld", value) produrrebbe per
buf
sufficientemente grande.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)
Converte un numero intero senza segno decimale in una stringa con il contenuto stesso di quello che std::sprintf(buf, "%u", value) produrrebbe per
buf
sufficientemente grande.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)
Converte un numero intero senza segno decimale in una stringa con il contenuto stesso di quello che std::sprintf(buf, "%lu", value) produrrebbe per
buf
sufficientemente grande.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)
Converte un numero intero senza segno decimale in una stringa con il contenuto stesso di quello che std::sprintf(buf, "%llu", value) produrrebbe per
buf
sufficientemente grande.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 Converte un valore in virgola mobile in una stringa con il contenuto stesso di quello che std::sprintf(buf, "%f", value) produrrebbe per
buf
sufficientemente grande.Original:
@7,8@ 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)
Converte un valore in virgola mobile in una stringa con il contenuto stesso di quello che std::sprintf(buf, "%Lf", value) produrrebbe per
buf
sufficientemente grande.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.
Indice |
Parametri
value | - | un valore numerico da convertire
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. |
Valore di ritorno
una stringa contenente il valore convertito
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.
Esempio
#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
Vedi anche
(C++11) |
converte un valore intero od a virgola mobile in una wstring (funzione) |