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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
##### `basic_string::replace` <a id="string.replace">[[string.replace]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
basic_string&
|
| 5 |
+
replace(size_type pos1, size_type n1,
|
| 6 |
+
const basic_string& str);
|
| 7 |
+
```
|
| 8 |
+
|
| 9 |
+
*Effects:* Equivalent to:
|
| 10 |
+
`return replace(pos1, n1, str.data(), str.size());`
|
| 11 |
+
|
| 12 |
+
``` cpp
|
| 13 |
+
basic_string&
|
| 14 |
+
replace(size_type pos1, size_type n1,
|
| 15 |
+
const basic_string& str,
|
| 16 |
+
size_type pos2, size_type n2 = npos);
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
*Throws:* `out_of_range` if `pos1 > size()` or `pos2 > str.size()`.
|
| 20 |
+
|
| 21 |
+
*Effects:* Determines the effective length `rlen` of the string to be
|
| 22 |
+
inserted as the smaller of `n2` and `str.size() - pos2` and calls
|
| 23 |
+
`replace(pos1, n1, str.data() + pos2, rlen)`.
|
| 24 |
+
|
| 25 |
+
*Returns:* `*this`.
|
| 26 |
+
|
| 27 |
+
``` cpp
|
| 28 |
+
basic_string& replace(size_type pos1, size_type n1,
|
| 29 |
+
basic_string_view<charT, traits> sv);
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
*Effects:* Equivalent to:
|
| 33 |
+
`return replace(pos1, n1, sv.data(), sv.size());`
|
| 34 |
+
|
| 35 |
+
``` cpp
|
| 36 |
+
template<class T>
|
| 37 |
+
basic_string& replace(size_type pos1, size_type n1, const T& t,
|
| 38 |
+
size_type pos2, size_type n2 = npos);
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
*Throws:* `out_of_range` if `pos1 > size()` or `pos2 > sv.size()`.
|
| 42 |
+
|
| 43 |
+
*Effects:* Creates a variable, `sv`, as if by
|
| 44 |
+
`basic_string_view<charT, traits> sv = t`. Determines the effective
|
| 45 |
+
length `rlen` of the string to be inserted as the smaller of `n2` and
|
| 46 |
+
`sv.size() - pos2` and calls
|
| 47 |
+
`replace(pos1, n1, sv.data() + pos2, rlen)`.
|
| 48 |
+
|
| 49 |
+
*Remarks:* This function shall not participate in overload resolution
|
| 50 |
+
unless `is_convertible_v<const T&, basic_string_view<charT, traits>>` is
|
| 51 |
+
`true` and `is_convertible_v<const T&, const charT*>` is `false`.
|
| 52 |
+
|
| 53 |
+
*Returns:* `*this`.
|
| 54 |
+
|
| 55 |
+
``` cpp
|
| 56 |
+
basic_string&
|
| 57 |
+
replace(size_type pos1, size_type n1, const charT* s, size_type n2);
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
*Requires:* `s` points to an array of at least `n2` elements of `charT`.
|
| 61 |
+
|
| 62 |
+
*Throws:* `out_of_range` if `pos1 > size()` or `length_error` if the
|
| 63 |
+
length of the resulting string would exceed `max_size()` (see below).
|
| 64 |
+
|
| 65 |
+
*Effects:* Determines the effective length `xlen` of the string to be
|
| 66 |
+
removed as the smaller of `n1` and `size() - pos1`. If
|
| 67 |
+
`size() - xlen >= max_size() - n2` throws `length_error`. Otherwise, the
|
| 68 |
+
function replaces the string controlled by \*`this` with a string of
|
| 69 |
+
length `size() - xlen + n2` whose first `pos1` elements are a copy of
|
| 70 |
+
the initial elements of the original string controlled by `*this`, whose
|
| 71 |
+
next `n2` elements are a copy of the initial `n2` elements of `s`, and
|
| 72 |
+
whose remaining elements are a copy of the elements of the original
|
| 73 |
+
string controlled by `*this` beginning at position `pos + xlen`.
|
| 74 |
+
|
| 75 |
+
*Returns:* `*this`.
|
| 76 |
+
|
| 77 |
+
``` cpp
|
| 78 |
+
basic_string&
|
| 79 |
+
replace(size_type pos, size_type n, const charT* s);
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
*Requires:* `s` points to an array of at least `traits::length(s) + 1`
|
| 83 |
+
elements of `charT`.
|
| 84 |
+
|
| 85 |
+
*Effects:* Equivalent to:
|
| 86 |
+
`return replace(pos, n, s, traits::length(s));`
|
| 87 |
+
|
| 88 |
+
``` cpp
|
| 89 |
+
basic_string&
|
| 90 |
+
replace(size_type pos1, size_type n1,
|
| 91 |
+
size_type n2, charT c);
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
*Effects:* Equivalent to `replace(pos1, n1, basic_string(n2, c))`.
|
| 95 |
+
|
| 96 |
+
*Returns:* `*this`.
|
| 97 |
+
|
| 98 |
+
``` cpp
|
| 99 |
+
basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str);
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
*Requires:* \[`begin()`, `i1`) and \[`i1`, `i2`) are valid ranges.
|
| 103 |
+
|
| 104 |
+
*Effects:* Calls `replace(i1 - begin(), i2 - i1, str)`.
|
| 105 |
+
|
| 106 |
+
*Returns:* `*this`.
|
| 107 |
+
|
| 108 |
+
``` cpp
|
| 109 |
+
basic_string& replace(const_iterator i1, const_iterator i2,
|
| 110 |
+
basic_string_view<charT, traits> sv);
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
*Requires:* \[`begin()`, `i1`) and \[`i1`, `i2`) are valid ranges.
|
| 114 |
+
|
| 115 |
+
*Effects:* Calls `replace(i1 - begin(), i2 - i1, sv)`.
|
| 116 |
+
|
| 117 |
+
*Returns:* `*this`.
|
| 118 |
+
|
| 119 |
+
``` cpp
|
| 120 |
+
basic_string&
|
| 121 |
+
replace(const_iterator i1, const_iterator i2, const charT* s, size_type n);
|
| 122 |
+
```
|
| 123 |
+
|
| 124 |
+
*Requires:* \[`begin()`, `i1`) and \[`i1`, `i2`) are valid ranges and
|
| 125 |
+
`s` points to an array of at least `n` elements of `charT`.
|
| 126 |
+
|
| 127 |
+
*Effects:* Calls `replace(i1 - begin(), i2 - i1, s, n)`.
|
| 128 |
+
|
| 129 |
+
*Returns:* `*this`.
|
| 130 |
+
|
| 131 |
+
``` cpp
|
| 132 |
+
basic_string& replace(const_iterator i1, const_iterator i2, const charT* s);
|
| 133 |
+
```
|
| 134 |
+
|
| 135 |
+
*Requires:* \[`begin()`, `i1`) and \[`i1`, `i2`) are valid ranges and
|
| 136 |
+
`s` points to an array of at least `traits::length(s) + 1` elements of
|
| 137 |
+
`charT`.
|
| 138 |
+
|
| 139 |
+
*Effects:* Calls `replace(i1 - begin(), i2 - i1, s, traits::length(s))`.
|
| 140 |
+
|
| 141 |
+
*Returns:* `*this`.
|
| 142 |
+
|
| 143 |
+
``` cpp
|
| 144 |
+
basic_string& replace(const_iterator i1, const_iterator i2, size_type n,
|
| 145 |
+
charT c);
|
| 146 |
+
```
|
| 147 |
+
|
| 148 |
+
*Requires:* \[`begin()`, `i1`) and \[`i1`, `i2`) are valid ranges.
|
| 149 |
+
|
| 150 |
+
*Effects:* Calls `replace(i1 - begin(), i2 - i1, basic_string(n, c))`.
|
| 151 |
+
|
| 152 |
+
*Returns:* `*this`.
|
| 153 |
+
|
| 154 |
+
``` cpp
|
| 155 |
+
template<class InputIterator>
|
| 156 |
+
basic_string& replace(const_iterator i1, const_iterator i2,
|
| 157 |
+
InputIterator j1, InputIterator j2);
|
| 158 |
+
```
|
| 159 |
+
|
| 160 |
+
*Requires:* \[`begin()`, `i1`), \[`i1`, `i2`) and \[`j1`, `j2`) are
|
| 161 |
+
valid ranges.
|
| 162 |
+
|
| 163 |
+
*Effects:* Calls
|
| 164 |
+
`replace(i1 - begin(), i2 - i1, basic_string(j1, j2, get_allocator()))`.
|
| 165 |
+
|
| 166 |
+
*Returns:* `*this`.
|
| 167 |
+
|
| 168 |
+
``` cpp
|
| 169 |
+
basic_string& replace(const_iterator i1, const_iterator i2,
|
| 170 |
+
initializer_list<charT> il);
|
| 171 |
+
```
|
| 172 |
+
|
| 173 |
+
*Requires:* \[`begin()`, `i1`) and \[`i1`, `i2`) are valid ranges.
|
| 174 |
+
|
| 175 |
+
*Effects:* Calls
|
| 176 |
+
`replace(i1 - begin(), i2 - i1, il.begin(), il.size())`.
|
| 177 |
+
|
| 178 |
+
*Returns:* `*this`.
|
| 179 |
+
|