Merge pull request #19 from floydspace/floydspace-patch-1
treat next letter after `.` as cap
This commit is contained in:
commit
21f80d9b9a
2
camel.go
2
camel.go
@ -49,7 +49,7 @@ func toCamelInitCase(s string, initCase bool) string {
|
|||||||
n += string(v)
|
n += string(v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if v == '_' || v == ' ' || v == '-' {
|
if v == '_' || v == ' ' || v == '-' || v == '.' {
|
||||||
capNext = true
|
capNext = true
|
||||||
} else {
|
} else {
|
||||||
capNext = false
|
capNext = false
|
||||||
|
@ -31,6 +31,7 @@ import (
|
|||||||
func TestToCamel(t *testing.T) {
|
func TestToCamel(t *testing.T) {
|
||||||
cases := [][]string{
|
cases := [][]string{
|
||||||
{"test_case", "TestCase"},
|
{"test_case", "TestCase"},
|
||||||
|
{"test.case", "TestCase"},
|
||||||
{"test", "Test"},
|
{"test", "Test"},
|
||||||
{"TestCase", "TestCase"},
|
{"TestCase", "TestCase"},
|
||||||
{" test case ", "TestCase"},
|
{" test case ", "TestCase"},
|
||||||
@ -56,6 +57,7 @@ func TestToLowerCamel(t *testing.T) {
|
|||||||
{"TestCase", "testCase"},
|
{"TestCase", "testCase"},
|
||||||
{"", ""},
|
{"", ""},
|
||||||
{"AnyKind of_string", "anyKindOfString"},
|
{"AnyKind of_string", "anyKindOfString"},
|
||||||
|
{"AnyKind.of-string", "anyKindOfString"},
|
||||||
}
|
}
|
||||||
for _, i := range cases {
|
for _, i := range cases {
|
||||||
in := i[0]
|
in := i[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user