1
0
mirror of https://github.com/beego/bee.git synced 2024-11-25 20:10:55 +00:00

Merge pull request #64 from cfsalguero/master

Fix camel case fails if name starts with _
This commit is contained in:
astaxie 2014-09-02 00:19:19 +08:00
commit ceab2d60e5

View File

@ -886,7 +886,7 @@ func formatSourceCode(filename string) {
func camelCase(in string) string { func camelCase(in string) string {
tokens := strings.Split(in, "_") tokens := strings.Split(in, "_")
for i := range tokens { for i := range tokens {
tokens[i] = strings.ToUpper(tokens[i][:1]) + tokens[i][1:] tokens[i] = strings.Title(strings.Trim(tokens[i], " "))
} }
return strings.Join(tokens, "") return strings.Join(tokens, "")
} }