Replace a substring with the specified replacement.
Synopsis
Declared in <bslstl_string.h>
template<class STRING_VIEW_LIKE_TYPE>
basic_string&
replace(
size_type outPosition,
size_type outNumChars,
STRING_VIEW_LIKE_TYPE const& replacement);
Description
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, and return a reference providing modifiable access to this string. Throw out_of_range if outPosition > length().
Return Value
reference to this string
Parameters
Name |
Description |
outPosition |
index at which replacement begins |
outNumChars |
number of characters to replace |
replacement |
string inserted in place of the replaced range |
Created with MrDocs