/** * replace text in string * @param str string * @param from string * @param to string */ string replaceAll(std::string str,std::string from, std::string to) { if(from.empty()) return str; size_t start_pos = 0; while((start_pos = str.find(from, start_pos)) != std::string::npos) { str.replace(start_pos, from.length(), to); start_pos += to.length(); } return str; }