| 57 | } |
| 58 | |
| 59 | static inline std::string title_case(std::string str) { |
| 60 | static std::regex whitespace(R"([_\s]+)"); |
| 61 | static std::regex specials(R"([^\sa-zA-Z0-9])"); |
| 62 | str = std::regex_replace(str, whitespace, " "); |
| 63 | str = std::regex_replace(str, specials, ""); |
| 64 | |
| 65 | char last = ' '; |
| 66 | for (auto it = str.begin(); it != str.end(); ++it) { |
| 67 | if (last == ' ') |
| 68 | *it = toupper(*it); |
| 69 | else |
| 70 | *it = tolower(*it); |
| 71 | last = *it; |
| 72 | } |
| 73 | return str; |
| 74 | } |
| 75 | |
| 76 | static inline std::string |
| 77 | replace_all(std::string str, const std::string &from, const std::string &to) { |
no test coverage detected