◐ Shell
clean mode source ↗

std::basic_string::insert – cppreference.com

Aus cppreference.com

<metanoindex/>

<tbody> </tbody>

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) (bis C + +11)
(seit C++11)

void insert( iterator pos, size_type count, CharT ch ); iterator insert( iterator pos, size_type count, CharT ch );

(7) (bis C + +11)
(seit C++11)

template< class InputIt > void insert( iterator i, InputIt first, InputIt last ); template< class InputIt > iterator insert( const_iterator i, InputIt first, InputIt last );

(8) (bis C + +11)

(seit C++11)

iterator insert( const_iterator pos, std::initializer_list<CharT> ilist );

(9) (seit C++11)

Fügt Zeichen in der Zeichenfolge:

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.

1)

Fügt count Kopien Charakter ch an der Position index

Original:

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.

2)

Fügt null-terminierte Zeichenkette, auf die s an der Position index. Die Länge der Zeichenfolge wird von der ersten Null-Zeichen (bestimmt effektiv Anrufe 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.

3)

Fügt den ersten count Zeichen aus der Zeichenkette, auf die s an der Position index. s kann null Zeichen enthalten .

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.

4)

Fügt String str an der Position index

Original:

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.

5)

Fügt eine Zeichenfolge, die von str.substr(index_str, count) an der Position index

Original:

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.

6)

Inserts Charakter ch vor dem Zeichen erhalten, auf die durch 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.

7)

Inserts count Kopien Charakter ch bevor das Element, um auf die durch 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.

8)

Inserts Zeichen aus dem Bereich [first, last)

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.

9)

Fügt Elemente aus Initialisierungsliste 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.

Parameter

index -

Position, an der der Inhalt eingefügt wird

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 -

Iterator vor dem die Zeichen eingefügt werden

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 -

Zeichen einfügen

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 -

Anzahl der Zeichen eingefügt werden soll

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 -

Zeiger auf die Zeichenkette einfügen

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 -

String einzufügen

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 -

reichen Definition Zeichen einzufügen

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 -

Position der ersten Zeichen in der Zeichenfolge str einzufügen

Original:

position of the first character in the string str to insert

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

ilist -

Initialisierungsliste die Zeichen aus einzufügen

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.

Rückgabewert

1-5) *this

6-9)

Iterator nach der letzten eingefügten Zeichen .

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.

Ausnahmen

1) std::out_of_range if index > size() and std::length_error if size() + count > max_size().

2) std::out_of_range if index > size() and std::length_error if size() + Traits::length(s) > max_size().

3) std::out_of_range if index > size() and std::length_error if size() + count > max_size().

4)

Wirft Ausnahmen auf den folgenden Bedingungen:.....

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.

a) std::out_of_range if index > size().

b)

std::length_error wenn size() + str.size() > max_size() wo ins_count ist die Anzahl der Zeichen, wird einfügbar .

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.

5)

Wirft Ausnahmen auf den folgenden Bedingungen:.....

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.

a) std::out_of_range if index > size().

b) std::out_of_range if index_str > str.size().

c)

std::length_error wenn size() + ins_count > max_size() wo ins_count ist die Anzahl der Zeichen, wird einfügbar .

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.

6-9)

(None)

Original:

(none)

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Siehe auch

fügt Zeichen bis zum Ende

Original:

appends characters to the end

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(öffentliche Elementfunktion) [edit]
fügt ein Zeichen an das Ende an
(öffentliche Elementfunktion) [edit]