Answers for "remove a str from a string"

10

removing a character from a string in c++

#include<iostream>
#include<algorithm>

using namespace std;
main() {
   string my_str = "ABAABACCABA";

   cout << "Initial string: " << my_str << endl;

   my_str.erase(remove(my_str.begin(), my_str.end(), 'A'), my_str.end()); //remove A from string
   cout << "Final string: " << my_str;
}
Posted by: Guest on October-15-2020

Code answers related to "remove a str from a string"

Python Answers by Framework

Browse Popular Code Answers by Language