about of string
char ToUpper(char c)
{
return (ch >= 'a' && ch <= 'z') ? (ch - 'a' + 'A') : ch;
}
char ToLower(char c)
{
return (ch >= 'A' && ch <= 'Z') ? (ch - 'A' + 'a') : ch;
}
std::string ToCamelCase(const std::string &input, bool lower_first)
{
bool capitalize_next = !lower_first;
std::string result;
result.reserve(input.size());
for(char character : input)
{
if(character == '_')
{
capitalize_next = true;
}
else if(capitalize_next)
{
result.push_back(ToUpper(character));
capitalize_next = false;
}
else
{
result.push_back(character);
}
}
if(lower_fist && !result.empty())
{
result[0] = ToLower(result[0]);
}
result;
}