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

`replace` overloads

== Synopses

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

Replace a substring of this string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]&
xref:bsl/basic_string-0faf/replace-0f.adoc[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);
----

[.small]#xref:bsl/basic_string-0faf/replace-0f.adoc[_» more&period;&period;&period;_]#

Replace a substring of this string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]&
xref:bsl/basic_string-0faf/replace-024.adoc[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,
    CHAR&lowbar;TYPE const* characterString);
----

[.small]#xref:bsl/basic_string-0faf/replace-024.adoc[_» more&period;&period;&period;_]#

Replace a substring of this string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]&
xref:bsl/basic_string-0faf/replace-021.adoc[replace](
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] outPosition,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] outNumChars,
    xref:bsl/basic_string-0faf.adoc[basic&lowbar;string] const& replacement);
----

[.small]#xref:bsl/basic_string-0faf/replace-021.adoc[_» more&period;&period;&period;_]#

Replace a substring of this string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]&
xref:bsl/basic_string-0faf/replace-03f.adoc[replace](
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] outPosition,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] outNumChars,
    CHAR&lowbar;TYPE const* characterString);
----

[.small]#xref:bsl/basic_string-0faf/replace-03f.adoc[_» more&period;&period;&period;_]#

Replace a substring of this string&period;


[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]&
xref:bsl/basic_string-0faf/replace-030.adoc[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,
    STRING&lowbar;VIEW&lowbar;LIKE&lowbar;TYPE const& replacement);
----

[.small]#xref:bsl/basic_string-0faf/replace-030.adoc[_» more&period;&period;&period;_]#

Replace a substring with the specified `replacement`&period;


[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]&
xref:bsl/basic_string-0faf/replace-094.adoc[replace](
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] outPosition,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] outNumChars,
    STRING&lowbar;VIEW&lowbar;LIKE&lowbar;TYPE const& replacement);
----

[.small]#xref:bsl/basic_string-0faf/replace-094.adoc[_» more&period;&period;&period;_]#

Replace a substring of this string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]&
xref:bsl/basic_string-0faf/replace-093.adoc[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/size_type.adoc[size&lowbar;type] numChars,
    CHAR&lowbar;TYPE character);
----

[.small]#xref:bsl/basic_string-0faf/replace-093.adoc[_» more&period;&period;&period;_]#

Replace a substring of this string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]&
xref:bsl/basic_string-0faf/replace-0b.adoc[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,
    CHAR&lowbar;TYPE const* characterString,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] numChars);
----

[.small]#xref:bsl/basic_string-0faf/replace-0b.adoc[_» more&period;&period;&period;_]#

Replace a substring of this string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]&
xref:bsl/basic_string-0faf/replace-039.adoc[replace](
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] outPosition,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] outNumChars,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] numChars,
    CHAR&lowbar;TYPE character);
----

[.small]#xref:bsl/basic_string-0faf/replace-039.adoc[_» more&period;&period;&period;_]#

Replace a substring of this string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]&
xref:bsl/basic_string-0faf/replace-0d.adoc[replace](
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] outPosition,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] outNumChars,
    CHAR&lowbar;TYPE const* characterString,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] numChars);
----

[.small]#xref:bsl/basic_string-0faf/replace-0d.adoc[_» more&period;&period;&period;_]#

Replace a substring of this string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class INPUT&lowbar;ITER&gt;
xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]&
xref:bsl/basic_string-0faf/replace-041.adoc[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,
    INPUT&lowbar;ITER stringFirst,
    INPUT&lowbar;ITER stringLast);
----

[.small]#xref:bsl/basic_string-0faf/replace-041.adoc[_» more&period;&period;&period;_]#

Replace a substring of this string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]&
xref:bsl/basic_string-0faf/replace-045.adoc[replace](
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] outPosition,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] outNumChars,
    xref:bsl/basic_string-0faf.adoc[basic&lowbar;string] const& replacement,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] position,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] numChars = npos);
----

[.small]#xref:bsl/basic_string-0faf/replace-045.adoc[_» more&period;&period;&period;_]#

Replace a substring of this string&period;


[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]&
xref:bsl/basic_string-0faf/replace-09d.adoc[replace](
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] outPosition,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] outNumChars,
    STRING&lowbar;VIEW&lowbar;LIKE&lowbar;TYPE const& replacement,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] position,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] numChars = npos);
----

[.small]#xref:bsl/basic_string-0faf/replace-09d.adoc[_» more&period;&period;&period;_]#

== Return Value

* reference providing modifiable access to this string
* reference 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
| *characterString*
| pointer to characters
| *outPosition*
| index at which replacement begins
| *outNumChars*
| number of characters to replace
| *numChars*
| number of characters
| *character*
| character value
| *stringFirst*
| beginning of the replacement range
| *stringLast*
| end of the replacement range
| *position*
| starting index
|===


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