Replace a substring of this string.
Declared in <bslstl_string.h>
basic_string&
replace(
size_type outPosition,
size_type outNumChars,
basic_string const& replacement);
Replace the specified outNumChars characters starting at the specified outPosition in this string (or the suffix of this string starting at outPosition if outPosition + outNumChars > length()) with the specified replacement string, and return a reference providing modifiable access to this string. Throw out_of_range if outPosition > length().
reference providing modifiable access to this string
| Name | Description |
|---|---|
| outPosition | index at which replacement begins |
| outNumChars | number of characters to replace |
| replacement | replacement character sequence |