What is the effective way to replace all occurrences of a character with another character in std::string?
std::string
Old School :-)
std::string str = "H:/recursos/audio/youtube/libre/falta/"; for (int i = 0; i < str.size(); i++) { if (str[i] == '/') { str[i] = '\\'; } } std::cout << str;
Result:
H:\recursos\audio\youtube\libre\falta\