Quote:
Originally Posted by DaWei
Nice, specific explanation.  . Are you replacing characters or sets of characters with characters or sets of characters of the same length, or will your substitutions require adjustments in length?
|
LOL, yes, I know. Well, I find all errors due to type problems in STL being amazingly non-specific. Usually it's better to stare long and hard at the code rather then trying to decipher the message itself.
Anyway, what I want to do is replace all occurances of a specific character with another character. I.e. the simplest case possible.
I found that the following code works:
int pos;
while((pos = my_string.find_first_of(" ")) != std::string::npos)
my_string[pos] = '_';
But, very C++ it isn't.