MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / replace

Method replace

src/Engine/Language.cpp:317–323  ·  view source on GitHub ↗

* Replaces every instance of a substring. * @param str The string to modify. * @param find The substring to find. * @param replace The substring to replace it with. */

Source from the content-addressed store, hash-verified

315 * @param replace The substring to replace it with.
316 */
317void Language::replace(std::string &str, const std::string &find, const std::string &replace)
318{
319 for (size_t i = str.find(find); i != std::string::npos; i = str.find(find, i + replace.length()))
320 {
321 str.replace(i, find.length(), replace);
322 }
323}
324
325/**
326 * Replaces every instance of a substring.

Callers 4

argMethod · 0.80
LocalizedText.hFile · 0.80
argMethod · 0.80
LocalizedText.cppFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected