Is there a nice simple way to replace all occurrences of "/"
in a std::string
with "\/"
to escape all the slashes in a std::string
?
Probably the simplest way to get this done is with boost string algorithms library.
boost::replace_all(myString, "/", "\\/");
std::string result = boost::replace_all_copy(myString, "/", "\\/");