Erase all occurrences of a character from a string.

Synopsis

Declared in <bslstl_string.h>

template<
    class CHAR_TYPE,
    class CHAR_TRAITS,
    class ALLOCATOR,
    class OTHER_CHAR_TYPE>
bsl::basic_string<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>::size_type
erase(
    basic_string<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>& str,
    OTHER_CHAR_TYPE const& c);

Description

Erase (in‐place) all the elements from the specified str that compare equal to the specified c, and return the number of erased elements.

Return Value

number of characters erased

Parameters

Name

Description

str

string to modify

c

character value to erase

Created with MrDocs