[#bsl-basic_string-0faf-erase-0c] = xref:bsl.adoc[bsl]::xref:bsl/basic_string-0faf.adoc[basic_string]::erase :relfileprefix: ../../ :mrdocs: Erase the substring in the half‐open range `[first, last)]`. == Synopsis Declared in `<bslstl_string.h>` [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_iterator] first, xref:bsl/basic_string-0faf/const_iterator.adoc[const_iterator] last); ---- == Description Return an iterator providing modifiable access to the character at the `last` position prior to erasing. If no such character exists, return `end()`. This method invalidates existing iterators pointing to `first` or a subsequent position. The behavior is undefined unless `first` and `last` are both within the range `[cbegin() .. cend()]` and `first <= last`. == 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]#