Echo89

C++ str_replace

Nov 19th, 2012
51
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. string str_replace(string fin, string rep, string str)
  2. {
  3.     if(str.find(fin) == string::npos) return str;
  4.     while(str.find(fin) != string::npos) str.replace(str.find(fin), fin.length(), rep);
  5.  
  6.     return str;
  7. }
RAW Paste Data