123456789
#include <algorithm> #include <string> std::string remove_char( std::string str, char ch ) { // remove all occurrences of char ch from str str.erase( std::remove( str.begin(), str.end(), ch ), str.end() ) ; return str ; }