pop a character from string c++ code example
Example 1: delete one specific character in string C++
#include <algorithm>
str.erase(std::remove(str.begin(), str.end(), 'a'), str.end());
Example 2: erasing a character from a string in c++
#include <iostream>
#include <string>
int main ()
{
std::string str ("This is an example sentence.");
std::cout << str << '\n';
str.erase (10,8);
std::cout << str << '\n';
str.erase (str.begin()+9);
std::cout << str << '\n';
str.erase (str.begin()+5, str.end()-9);
std::cout << str << '\n';
return 0;
}