diff --git a/camel.go b/camel.go index 9f3381a..7808847 100644 --- a/camel.go +++ b/camel.go @@ -68,6 +68,9 @@ func ToLowerCamel(s string) string { if s == "" { return s } + if strings.Index(s, "ID") != -1 { + s = strings.Replace(s, "ID", "Id", -1) + } if r := rune(s[0]); r >= 'A' && r <= 'Z' { s = strings.ToLower(string(r)) + s[1:] } diff --git a/camel_test.go b/camel_test.go index 92e397b..4f42bdd 100644 --- a/camel_test.go +++ b/camel_test.go @@ -56,6 +56,8 @@ func TestToLowerCamel(t *testing.T) { {"TestCase", "testCase"}, {"", ""}, {"AnyKind of_string", "anyKindOfString"}, + {"UserID", "userId"}, + {"ID", "id"}, } for _, i := range cases { in := i[0]