[#bsl-basic_string-0e-replace-049]
= xref:bsl.adoc[bsl]::xref:bsl/basic_string-0e.adoc[basic&lowbar;string&lt;wchar&lowbar;t&gt;]::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 `replacement`&period; Return a reference providing modifiable access to this string&period; The behavior is undefined unless `first` and `last` are both within the range `&lsqb;cbegin() &period;&period; cend()&rsqb;` and `first &lt;&equals; last`&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;string&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class STRING&lowbar;VIEW&lowbar;LIKE&lowbar;TYPE&gt;
xref:bsl/basic_string-0faf.adoc[basic&lowbar;string&lt;wchar&lowbar;t&gt;]&
replace(
    xref:bsl/basic_string-0e/const_iterator.adoc[const&lowbar;iterator] first,
    xref:bsl/basic_string-0e/const_iterator.adoc[const&lowbar;iterator] last,
    STRING&lowbar;VIEW&lowbar;LIKE&lowbar;TYPE const& replacement);
----


[.small]#Created with https://www.mrdocs.com[MrDocs]#
