Echo89

C++ str_replace

Nov 19th, 2012
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.21 KB | None | 0 0
  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. }
Add Comment
Please, Sign In to add comment