From 689d5151384f4e91f9945437bad228f742717005 Mon Sep 17 00:00:00 2001 From: Victor Korzunin Date: Tue, 5 Nov 2019 00:21:21 +0100 Subject: [PATCH 1/2] treat next letter after `.` as cap --- camel.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camel.go b/camel.go index 9f3381a..c2f01b1 100644 --- a/camel.go +++ b/camel.go @@ -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 From 5c71f7c32a50de355219c73c7ba330d07ddd86bc Mon Sep 17 00:00:00 2001 From: Victor Korzunin Date: Wed, 6 Nov 2019 08:36:36 +0100 Subject: [PATCH 2/2] Add new test cases --- camel_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/camel_test.go b/camel_test.go index 92e397b..f1f71ba 100644 --- a/camel_test.go +++ b/camel_test.go @@ -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]