Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. std::string replaceStr(std::string str, std::string oldVal, std::string newVal)
  5. {
  6.     while (str.find(oldVal) != std::string::npos)
  7.     {
  8.     str.replace(str.find(oldVal), oldVal.length(), newVal);
  9.     }
  10.  
  11.     return str;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement