Finds and replaces a set of substrings in a string.
| 224 | |
| 225 | // Finds and replaces a set of substrings in a string. |
| 226 | std::string format( |
| 227 | const std::string& str, |
| 228 | const std::vector<std::string>& find, |
| 229 | const std::vector<std::string>& replace) |
| 230 | { |
| 231 | std::string out = str; |
| 232 | for (std::size_t i=0; i<find.size(); ++i) { |
| 233 | find_and_replace(out, find[i], replace[i]); |
| 234 | } |
| 235 | return out; |
| 236 | } |
| 237 | |
| 238 | // GLUT display function that runs test. Must be run within the display loop |
| 239 | // in order to properly destroy resources. |
no test coverage detected