MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/xstudio / title_case

Function title_case

include/xstudio/utility/string_helpers.hpp:59–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59static 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
76static inline std::string
77replace_all(std::string str, const std::string &from, const std::string &to) {

Callers 2

get_data_dntagMethod · 0.85
refresh_snippetMethod · 0.85

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected