Convert an underscore_based_identifier in to camelCase. Also uppercases the first character if first is true.
| 95 | // Convert an underscore_based_identifier in to camelCase. |
| 96 | // Also uppercases the first character if first is true. |
| 97 | std::string MakeCamel(const std::string &in, bool first) { |
| 98 | std::string s; |
| 99 | for (size_t i = 0; i < in.length(); i++) { |
| 100 | if (!i && first) |
| 101 | s += CharToUpper(in[0]); |
| 102 | else if (in[i] == '_' && i + 1 < in.length()) |
| 103 | s += CharToUpper(in[++i]); |
| 104 | else |
| 105 | s += in[i]; |
| 106 | } |
| 107 | return s; |
| 108 | } |
| 109 | |
| 110 | // Convert an underscore_based_identifier in to screaming snake case. |
| 111 | std::string MakeScreamingCamel(const std::string &in) { |
no test coverage detected