79496554

Date: 2025-03-09 20:36:39
Score: 0.5
Natty:
Report link

One more option is to do this using a simple for loop:

for (size_t pos = str.find(search); pos != std::string::npos; 
     pos = str.find(search, pos + replacement.length())) {
    str.replace(pos, search.length(), replacement);
}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Haim