Here's some code that removes the specified character, ch, from the string passed in. Is there a better way to do this? Specifically, one that's more efficient and/or portable?
//returns string without any 'ch' characters in it, if any.
#include <string>
using namespace std;
string strip(string str, const char ch)
{
size_t p = 0; //position of any 'ch'
while ((p = str.find(ch, p)) != string::npos)
str.erase(p, 1);
return str;
}

str.erase(std::remove(str.begin(), str.end(), ch), str.end());– Corbin Nov 10 '12 at 1:21