String Replace - int goes to garbage!
Posted on 2003-11-13
How do I work this piece of code, so that when the find hits the end of string it stops?
Right now, when it hits the end of the string... it feeds garbage (4294967295) into "place".
I have put ** next to the problem code.
for(pos; pos < speech1.max_size(); pos)
place = speech1.find(match1, pos);
if(place != speech1.max_size())
** speech1.replace(place, match1.length(), " he or she ");
pos = place + match1.length();
pos = pos + 6;
place = pos;