Puoi usare questa funzione passandole come replace una stringa vuota (""):
codice:
//Replaces all the instances of search with replace in string; returns the number of substitutions done
unsigned int ReplaceString(std::string & string,const std::string & search,const std::string & replace)
{
unsigned int ret=0;
for(std::string::size_type pos=string.find(search);pos!=string.npos;ret++,pos=string.find(search,pos))
{
string.replace(pos,search.length(),replace);
pos+=replace.length();
}
return ret;
}
.
Ah, in questo forum il tag per inserire codice è [code] ... [/code].