fork(3) download
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4.  
  5. int main()
  6. {
  7. std::string str("Herr Müller ist ein König.");
  8.  
  9. std::string findA = "ü";
  10. std::string replaceWith = "ue";
  11.  
  12. size_t pos = 0;
  13. while ((pos = str.find(findA, pos)) != std::string::npos)
  14. {
  15. str.replace(pos, findA.length(), replaceWith);
  16. pos += replaceWith.length();
  17. }
  18.  
  19. std::cout << str << std::endl;
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 4552KB
stdin
Standard input is empty
stdout
Herr Mueller ist ein König.