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

`erase` overloads

== Synopses

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

Erase characters from this string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0faf/iterator.adoc[iterator]
xref:bsl/basic_string-0faf/erase-0d.adoc[erase](xref:bsl/basic_string-0faf/const_iterator.adoc[const&lowbar;iterator] position);
----

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

Erase the substring in the half&hyphen;open range `&lsqb;first, last)&rsqb;`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0faf/iterator.adoc[iterator]
xref:bsl/basic_string-0faf/erase-0c.adoc[erase](
    xref:bsl/basic_string-0faf/const_iterator.adoc[const&lowbar;iterator] first,
    xref:bsl/basic_string-0faf/const_iterator.adoc[const&lowbar;iterator] last);
----

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

Erase characters from this string&period;


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

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

== Return Value

* iterator following the last removed character
* reference providing modifiable access to this string

== Parameters

[cols="1,4"]
|===
| Name| Description
| *position*
| starting index
| *first*
| beginning of the range to erase
| *last*
| end of the range to erase
| *numChars*
| number of characters
|===


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