std::wstring As_All_Lowercase_Letters_With_Spaces_As_Underscores(std::wstring s){ trim(s); Squeeze_Away_Spaces(s); for (auto & it: s){ if (it == L' '){ it =L'_'; } else { it = static_cast<char>(tolower(it)); } } return s; }
std::string As_All_Capital_Letters_With_Spaces_As_Underscores(std::string s) { trim(s); Squeeze_Away_Spaces(s); for (auto & it: s){ if (it == ' '){ it ='_'; } else { it = static_cast<char>(toupper(it)); } } return s; }
std::wstring Make_Capital_And_Underscored_In_User_Type_Format(std::wstring s) { trim(s); Squeeze_Away_Spaces(s); //turn spaces into underscores and capitalize each letter bool was_space = true; // <- capitalize the first character every time for (auto & it: s){ if (it == L' ' || it == L'_'){ it =L'_'; was_space = true; }else{ if (was_space){ it = static_cast<char>(toupper(it)); was_space = false; } } } return s; }