[#bsl-basic_string-0ce-erase-04] = xref:bsl.adoc[bsl]::xref:bsl/basic_string-0ce.adoc[basic_string<char16_t>]::erase :relfileprefix: ../../ :mrdocs: Erase from this string the substring of length the optionally specified `numChars` or `original.length() ‐ position`, whichever is smaller, starting at the optionally specified `position`. If `position` is not specified, the first position is used (i.e., `position` is set to 0). Return a reference providing modifiable access to this string. If `numChars` equals `npos`, then the remaining length of the string is erased (i.e., `numChars` is set to `length() ‐ position`). Throw `out_of_range` if `position > length()`. == Synopsis Declared in `<bslstl_string.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/basic_string-0faf.adoc[basic_string<char16_t>]& erase( xref:bsl/basic_string-0ce/size_type.adoc[size_type] position = 0, xref:bsl/basic_string-0ce/size_type.adoc[size_type] numChars = npos); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#