std::basic_string::insert
Da cppreference.com.
< cpp | string | basic string
![]() |
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. |
basic_string& insert( size_type index, size_type count, CharT ch ); |
(1) | |
basic_string& insert( size_type index, const CharT* s ); |
(2) | |
basic_string& insert( size_type index, const CharT* s, size_type count ); |
(3) | |
basic_string& insert( size_type index, const basic_string& str ); |
(4) | |
basic_string& insert( size_type index, const basic_string& str, size_type index_str, size_type count ); |
(5) | |
iterator insert( iterator pos, CharT ch ); iterator insert( const_iterator pos, CharT ch ); |
(6) | (fino al c++11) (dal C++11) |
void insert( iterator pos, size_type count, CharT ch ); iterator insert( iterator pos, size_type count, CharT ch ); |
(7) | (fino al c++11) (dal C++11) |
template< class InputIt > void insert( iterator i, InputIt first, InputIt last ); |
(8) | (fino al c++11) (dal C++11) |
iterator insert( const_iterator pos, std::initializer_list<CharT> ilist ); |
(9) | (dal C++11) |
Inserisce caratteri nella stringa:
Original:
Inserts characters into the string:
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.
1)
Inserti
count
copie di ch
carattere nella index
posizioneOriginal:
Inserts
count
copies of character ch
at the position index
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)
Inserti con terminazione null stringa di caratteri a cui punta
s
al index
posizione. La lunghezza della stringa è determinata dal carattere null primo (efficacemente chiamate Traits::length(s). Original:
Inserts null-terminated character string pointed to by
s
at the position index
. The length of the string is determined by the first null character (effectively calls Traits::length(s). 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)
Inserisce i caratteri
count
prime la stringa di caratteri a cui punta s
al index
posizione. s
può contenere caratteri nulli.Original:
Inserts the first
count
characters from the character string pointed to by s
at the position index
. s
can contain null characters.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)
Inserti
str
corda al index
posizioneOriginal:
Inserts string
str
at the position index
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)
Inserisce una stringa, ottenuta str.substr(index_str, count) al
index
posizioneOriginal:
Inserts a string, obtained by str.substr(index_str, count) at the position
index
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)
Inserisce
ch
carattere prima del carattere puntato da pos
Original:
Inserts character
ch
before the character pointed by pos
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)
Inserti
count
copie di ch
carattere prima l'elemento puntato da pos
Original:
Inserts
count
copies of character ch
before the element pointed to by pos
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.
8)
Inserisce personaggi del
[first, last)
gamma Original:
Inserts characters from the range
[first, last)
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)
Inserisce elementi di lista di inizializzazione
ilist
. Original:
Inserts elements from initializer list
ilist
. 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
index | - | posizione in cui il contenuto verrà inserito
Original: position at which the content will be inserted The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
pos | - | iteratore prima che i personaggi verranno inseriti
Original: iterator before which the characters will be inserted The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
ch | - | carattere da inserire
Original: character to insert The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
count | - | numero di caratteri da inserire
Original: number of characters to insert The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
s | - | puntatore alla stringa di caratteri da inserire
Original: pointer to the character string to insert The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
str | - | stringa da inserire
Original: string to insert The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
first, last | - | vanno definendo i caratteri da inserire
Original: range defining characters to insert The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
index_str | - | posizione del primo carattere della stringa da inserire
str Original: position of the first character in the string str to insertThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
ilist | - | inizializzatore lista per inserire i personaggi
Original: initializer list to insert the characters from The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Type requirements | ||
-InputIt must meet the requirements of InputIterator .
|
[modifica] Valore di ritorno
1-5) *this
6-9)
Iterator dopo l'ultimo carattere inserito.
Original:
Iterator following the last inserted character.
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] Eccezioni
2) std::out_of_range if index > size() and std::length_error if size() + Traits::length(s) > max_size().
4)
Genera eccezioni alle seguenti condizioni:
Original:
Throws exceptions on the following conditions:
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.
b)
std::length_error se size() + str.size() > max_size()
ins_count
dove è il numero di caratteri che verranno inseriti.Original:
std::length_error if size() + str.size() > max_size() where
ins_count
is the number of characters that will be inserted.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)
Genera eccezioni alle seguenti condizioni:
Original:
Throws exceptions on the following conditions:
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.
c)
std::length_error se size() + ins_count > max_size()
ins_count
dove è il numero di caratteri che verranno inseriti.Original:
std::length_error if size() + ins_count > max_size() where
ins_count
is the number of characters that will be inserted.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-9)
(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] Vedi anche
aggiunge caratteri in coda (metodo pubblico) | |
aggiunge un carattere in coda (metodo pubblico) |