使用迭代器删除string中指定位置的字符!
string str = "huehfudhfruhgfsfgkhdyfsghydff"; string::iterator itr =
str.begin(); itr += 2; str.erase(itr);
使用下标删除string中指定位置的字符!
string s = "dyegyswdgcgshjdcfgsd"; s.erase(5,1); //删除下标为5的元素! cout << s <<
endl; //输出: //dyegywdgcgshjdcfgsd
 

删除string中指定的所有字符!
str.erase(std::remove(str.begin(), str.end(), 'e'), str.end());