Skip to content

Commit

Permalink
Simplify ToCamelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
johanbrandhorst authored and stanley-cheung committed Jan 8, 2019
1 parent 3d280c3 commit f181d1e
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions javascript/net/grpc/web/grpc_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -258,18 +258,11 @@ string JSFieldName(const FieldDescriptor *desc)
// Like ToUpperCamel except the first letter is not converted.
string ToCamelCase(const std::vector<string>& words)
{
if words.size() == 0 {
return ""
if (words.size() == 0) {
return "";
}
string result = words[0]
for (size_t i = 1; i < words.size(); i++) {
string word = words[i];
if (word[0] >= 'a' && word[0] <= 'z') {
word[0] = (word[0] - 'a') + 'A';
}
result += word;
}
return result;
string result = words[0];
return result + ToUpperCamel(std::vector<string>(words.begin()+1, words.begin()+words.size()));
}

// Like JSFieldName, but with first letter not uppercased
Expand Down

0 comments on commit f181d1e

Please sign in to comment.