64,654
社区成员
发帖
与我相关
我的任务
分享
#include <string>
#include <iostream>
using namespace std;
void removeAll(string &str,char c)
{
string::iterator new_end = remove_if(str.begin(), str.end(), bind2nd(equal_to<char>(),c));
str.erase(new_end, str.end());
}
int main()
{
string tmp="12\\34\\56\\";
cout<< tmp <<endl;
removeAll(tmp,'\\');
cout<< tmp <<endl;
return 0;
}