#ifndef UWWWU_UTIL_H #define UWWWU_UTIL_H #include #include #include class Util { public: //! Will replace all occurrences of a substring `find` in `str` with `sub`, but it will try to keep the characters signs. //! Like (pay attention to the capitalization):. //! ("Hello World", "hello", "hi") -> "Hi World". //! ("hello World", "hello", "hi") -> "hi World". //! ("HELLO World", "hello", "hi") -> "HI World". //! You can also supply a callback to only perform a replacement if certain conditions apply. static std::string ConditionalReplaceButKeepSigns( const std::string& str, std::string find, const std::string& sub, const std::function& onlyIf = [](auto, auto, auto) { return true; } // Default is: replace always ); }; #endif //UWWWU_UTIL_H