Merge pull request #19 from floydspace/floydspace-patch-1

treat next letter after `.` as cap
This commit is contained in:
iancoleman 2019-11-13 09:53:59 +11:00 committed by GitHub
commit 21f80d9b9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -49,7 +49,7 @@ func toCamelInitCase(s string, initCase bool) string {
n += string(v)
}
}
if v == '_' || v == ' ' || v == '-' {
if v == '_' || v == ' ' || v == '-' || v == '.' {
capNext = true
} else {
capNext = false

View File

@ -31,6 +31,7 @@ import (
func TestToCamel(t *testing.T) {
cases := [][]string{
{"test_case", "TestCase"},
{"test.case", "TestCase"},
{"test", "Test"},
{"TestCase", "TestCase"},
{" test case ", "TestCase"},
@ -56,6 +57,7 @@ func TestToLowerCamel(t *testing.T) {
{"TestCase", "testCase"},
{"", ""},
{"AnyKind of_string", "anyKindOfString"},
{"AnyKind.of-string", "anyKindOfString"},
}
for _, i := range cases {
in := i[0]