Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

how we can write code to remove a character in c++

nclude<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;
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #write #code #remove #character
ADD COMMENT
Topic
Name
7+3 =