Defined in omni/extras/StringHelpers.h

inline void omni::extras::replaceAll(std::string &str, const std::string &subStr, const std::string &replaceWith)

Replaces all instances of a substring within a given string with a replacement value.

This function calls std::string::replace() in a loop so that all instances are replaced.


The replacement is not recursive, so replaceWith may contain the substring subStr without causing endless recursion. Whenever a replacement occurs, the search for subStr resumes after the inserted replaceWith.

  • str – The string to modify in-place

  • subStr – The substring to find within str

  • replaceWith – The substring that all instances of subStr are replaced with