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

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

== Synopsis

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

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

== Description

Return an iterator providing modifiable access to the character at the `last` position prior to erasing&period; If no such character exists, return `end()`&period; This method invalidates existing iterators pointing to `first` or a subsequent position&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

iterator following the last removed character

== Parameters

[cols="1,4"]
|===
| Name| Description
| *first*
| beginning of the range to erase
| *last*
| end of the range to erase
|===


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