yum-mirror/UwwwuPP
A rehost of leonetienne's UwwwuPP, a simple text filter to uwu-ify English text.
git clone https://git.yummers.dev/yum-mirror/UwwwuPP
b172ec9
master
1#ifndef UWWWU_UTIL_H 2#define UWWWU_UTIL_H 3 4#include <string> 5#include <functional> 6#include <cstddef> 7 8class Util { 9public : 10//! Will replace all occurrences of a substring `find` in `str` with `sub`, but it will try to keep the characters signs. 11//! Like (pay attention to the capitalization):. 12//! ("Hello World", "hello", "hi") -> "Hi World". 13//! ("hello World", "hello", "hi") -> "hi World". 14//! ("HELLO World", "hello", "hi") -> "HI World". 15//! You can also supply a callback to only perform a replacement if certain conditions apply. 16static std ::string ConditionalReplaceButKeepSigns ( 17const std ::string & str , 18std ::string find , 19const std ::string & sub , 20const std ::function < bool (const std ::string & ,const std ::string & ,const std ::size_t )>& onlyIf = 21 [](auto, auto, auto) {return true; }// Default is: replace always 22 ); 23}; 24 25 26#endif //UWWWU_UTIL_H