Search
 
SCRIPT & CODE EXAMPLE
 

CPP

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;
}
Comment

delete one specific character in string C++

#include <algorithm>
str.erase(std::remove(str.begin(), str.end(), 'a'), str.end());
Comment

str remove char c++

static  void StrRemoveChar(std::string& s1, char l)
{
  s1.erase(std::remove(s1.begin(), s1.end(), l), s1.end());
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ round number up 
Cpp :: findung the mode in c++ 
Cpp :: what is _asm in C++ 
Cpp :: maximum value in map in c++ 
Cpp :: time delay in c++ 
Cpp :: c++ matrix as argument 
Cpp :: c++ how to check whether a file exists? 
Cpp :: sort function from bigest to smallest c++ 
Cpp :: how to make for loop in c++ 
Cpp :: qt popup window 
Cpp :: malloc in c++ 
Cpp :: remove last character from string c++ 
Cpp :: wine linux 
Cpp :: difference between lower and upper bound 
Cpp :: C++ switch - case - break 
Cpp :: Frequency of a substring in a string C++ 
Cpp :: run c++ program in mac terminal 
Cpp :: c++ pointer null vs nullptr 
Cpp :: number of words in c++ files 
Cpp :: abs in c++ 
Cpp :: cpp init multidimensional vector 
Cpp :: string iterator in c++ 
Cpp :: why we use iostream in C++ programming 
Cpp :: int to hex arduino 
Cpp :: time_t to int 
Cpp :: c++ int 
Cpp :: C++ Vector Iterator Syntax 
Cpp :: how to split string in c++ 
Cpp :: for loop f# 
Cpp :: how to print a text in c++ 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =