[#bsl-basic_string-0faf-replace-0f]
= xref:bsl.adoc[bsl]::xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]::replace
:relfileprefix: ../../
:mrdocs:

Replace a substring of this string&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]&
replace(
    xref:bsl/basic_string-0faf/const_iterator.adoc[const&lowbar;iterator] first,
    xref:bsl/basic_string-0faf/const_iterator.adoc[const&lowbar;iterator] last,
    xref:bsl/basic_string-0faf.adoc[basic&lowbar;string] const& replacement);
----

== Description

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 &grave;first &lt;&equals; last&grave;&period;

== Return Value

reference providing modifiable access to this string

== Parameters

[cols="1,4"]
|===
| Name| Description
| *first*
| beginning of the range (inclusive)
| *last*
| end of the range (exclusive)
| *replacement*
| replacement character sequence
|===


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