[#bsl-basic_string-0fb-replace-0b]
= xref:bsl.adoc[bsl]::xref:bsl/basic_string-0fb.adoc[basic&lowbar;string&lt;char&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` string&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"]
----
xref:bsl/basic_string-0faf.adoc[basic&lowbar;string&lt;char&gt;]&
replace(
    xref:bsl/basic_string-0fb/const_iterator.adoc[const&lowbar;iterator] first,
    xref:bsl/basic_string-0fb/const_iterator.adoc[const&lowbar;iterator] last,
    xref:bsl/basic_string-0faf.adoc[basic&lowbar;string&lt;char&gt;] const& replacement);
----


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