[#bsl-basic_string-01d-replace-0a20] = xref:bsl.adoc[bsl]::xref:bsl/basic_string-01d.adoc[basic_string<char8_t>]::replace :relfileprefix: ../../ :mrdocs: Replace the substring in the range starting at the specified `first` position and ending right before the specified `last` position with the specified initial `numChars` characters in the specified `characterString`. Return a reference providing modifiable access to this string. The behavior is undefined unless `first` and `last` are both within the range `[cbegin() .. cend()]`, `first <= last`, and `characterString` is at least `numChars` long. == Synopsis Declared in `<bslstl_string.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/basic_string-0faf.adoc[basic_string<char8_t>]& replace( xref:bsl/basic_string-01d/const_iterator.adoc[const_iterator] first, xref:bsl/basic_string-01d/const_iterator.adoc[const_iterator] last, char8_t const* characterString, xref:bsl/basic_string-01d/size_type.adoc[size_type] numChars); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#