c++编程:从字符串中删除指定的字符
c++编程:从字符串中删除指定的字符
日期:2019-11-13 22:13:13 人气:1
#include
#include
usingnamespacestd;
intmain(){
strings="-daas-j--kdj-al-";
string::iteratorit;
for(it=s.begin();it!=s.end();it++)
if(*it=='-'){
s.erase(it);
it--;
}
cout<<s<<endl;
return0;
}
扩展资料
C++从string中删除一个字符
#include