std::basic_istringstream::str
Da cppreference.com.
< cpp | io | basic istringstream
![]() | 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. |
std::basic_string<CharT,Traits,Allocator> str()const; | (1) | |
void str(conststd::basic_string<CharT,Traits,Allocator>& new_str); | (2) | |
Gestisce il contenuto dell'oggetto stringa sottostante.
1) Original:
Manages the contents of the underlying string object.
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.
Restituisce una copia della stringa sottostante come se chiamando rdbuf()->str().
2) Original:
Returns a copy of the underlying string as if by calling rdbuf()->str().
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.
Sostituisce il contenuto della stringa sottostante come se chiamando rdbuf()->str(new_str).
Original:
Replaces the contents of the underlying string as if by calling rdbuf()->str(new_str).
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 |
[modifica]Parametri
new_str | - | nuovi contenuti della stringa sottostante Original: new contents of the underlying string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[modifica]Valore di ritorno
1)una copia dell'oggetto stringa sottostante.
2) Original:
a copy of the underlying string object.
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.
(Nessuno)
Original:
(none)
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.
[modifica]Esempio
#include <sstream>#include <iostream>int main(){int n; std::istringstream in;// could also use in("1 2") in.str("1 2"); in >> n;std::cout<<"after reading the first int from \"1 2\", the int is "<< n <<", str() = \""<< in.str()<<"\"\n"; std::ostringstream out("1 2"); out <<3;std::cout<<"after writing the int '3' to output stream \"1 2\""<<", str() = \""<< out.str()<<"\"\n"; std::ostringstream ate("1 2", std::ios_base::ate); ate <<3;std::cout<<"after writing the int '3' to append stream \"1 2\""<<", str() = \""<< ate.str()<<"\"\n";}
Output:
after reading the first int from "1 2", the int is 1, str() = "1 2" after writing the int '3' to output stream "1 2", str() = "3 2" after writing the int '3' to append stream "1 2", str() = "1 23"
[modifica]Vedi anche
sostituisce o ottiene una copia della stringa di caratteri associata Original: replaces or obtains a copy of the associated character string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) |