Hello, I'm writing a function that takes a string and process it in a way to replace all occurences of "+-" with "-".
This is what I've done:
And this works, but I wonder if this could be done in more elegant way.Code:
void foo (string& str)
string :: size_type ind;
ind = str.find ("+-");
while (ind != string :: npos)
str.replace (ind, strlen("+-"),"-");
ind = str.find ("+-", ind + 2);
Please, give me some advices.