[#bsl-erase_if-0e] = xref:bsl.adoc[bsl]::erase_if :relfileprefix: ../ :mrdocs: Erase all characters matching a predicate from a string. == Synopsis Declared in `<bslstl_string.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class CHAR_TYPE, class CHAR_TRAITS, class ALLOCATOR, class UNARY_PREDICATE> bsl::basic_string<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>::size_type erase_if( xref:bsl/basic_string-0faf.adoc[basic_string<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>]& str, UNARY_PREDICATE const& pred); ---- == Description Erase (in‐place) all the elements from the specified `str` where the specified `pred` returns `true`, and return the number of erased elements. == Return Value number of characters erased == Parameters [cols="1,4"] |=== | Name| Description | *str* | string to modify | *pred* | unary predicate selecting characters to erase |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#