A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://timsong-cpp.github.io/cppwp/n4140/string::replace below:

[string::replace]

21.4.6.6 basic_string::replace [string::replace]

basic_string& replace(size_type pos1, size_type n1, const basic_string& str);

Requires: pos1 <= size().

Throws: out_of_range if pos1 > size().

Effects: Calls replace(pos1, n1, str.data(), str.size()).

basic_string& replace(size_type pos1, size_type n1, const basic_string& str, size_type pos2, size_type n2 = npos);

Requires: pos1 <= size() and pos2 <= str.size().

Throws: out_of_range if pos1 > size() or pos2 > str.size().

Effects: Determines the effective length rlen of the string to be inserted as the smaller of n2 and str.size() - pos2 and calls replace(pos1, n1, str.data() + pos2, rlen).

basic_string& replace(size_type pos1, size_type n1, const charT* s, size_type n2);

Requires: pos1 <= size() and s points to an array of at least n2 elements of charT.

Throws: out_of_range if pos1 > size() or length_error if the length of the resulting string would exceed max_size() (see below).

Effects: Determines the effective length xlen of the string to be removed as the smaller of n1 and size() - pos1. If size() - xlen >= max_size() - n2 throws length_error. Otherwise, the function replaces the string controlled by *this with a string of length size() - xlen + n2 whose first pos1 elements are a copy of the initial elements of the original string controlled by *this, whose next n2 elements are a copy of the initial n2 elements of s, and whose remaining elements are a copy of the elements of the original string controlled by *this beginning at position pos + xlen.

basic_string& replace(size_type pos, size_type n, const charT* s);

Requires: pos <= size() and s points to an array of at least traits::length(s) + 1 elements of charT.

Effects: Calls replace(pos, n, s, traits::length(s)).

basic_string& replace(size_type pos1, size_type n1, size_type n2, charT c);

Effects: Equivalent to replace(pos1, n1, basic_string(n2, c)).

basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str);

Requires: [begin(),i1) and [i1,i2) are valid ranges.

Effects: Calls replace(i1 - begin(), i2 - i1, str).

basic_string& replace(const_iterator i1, const_iterator i2, const charT* s, size_type n);

Requires: [begin(),i1) and [i1,i2) are valid ranges and s points to an array of at least n elements of charT.

Effects: Calls replace(i1 - begin(), i2 - i1, s, n).

basic_string& replace(const_iterator i1, const_iterator i2, const charT* s);

Requires: [begin(),i1) and [i1,i2) are valid ranges and s points to an array of at least traits::length(s) + 1 elements of charT.

Effects: Calls replace(i1 - begin(), i2 - i1, s, traits::length(s)).

basic_string& replace(const_iterator i1, const_iterator i2, size_type n, charT c);

Requires: [begin(),i1) and [i1,i2) are valid ranges.

Effects: Calls replace(i1 - begin(), i2 - i1, basic_string(n, c)).

template<class InputIterator> basic_string& replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2);

Requires: [begin(),i1), [i1,i2) and [j1,j2) are valid ranges.

Effects: Calls replace(i1 - begin(), i2 - i1, basic_string(j1, j2)).

basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<charT> il);

Requires: [begin(),i1) and [i1,i2) are valid ranges.

Effects: Calls replace(i1 - begin(), i2 - i1, il.begin(), il.size()).


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4