diff --git a/camel.go b/camel.go index f31646e..cd5a260 100644 --- a/camel.go +++ b/camel.go @@ -31,6 +31,7 @@ import ( // Converts a string to CamelCase func toCamelInitCase(s string, initCase bool) string { + s = strings.TrimSpace(s) if s == "" { return s } diff --git a/camel_test.go b/camel_test.go index bacf8f7..af0545c 100644 --- a/camel_test.go +++ b/camel_test.go @@ -68,6 +68,8 @@ func toLowerCamel(tb testing.TB) { {"AnyKind of_string", "anyKindOfString"}, {"AnyKind.of-string", "anyKindOfString"}, {"ID", "id"}, + {"some string", "someString"}, + {" some string", "someString"}, } for _, i := range cases { in := i[0] diff --git a/snake_test.go b/snake_test.go index 2e34372..c1ea2f1 100644 --- a/snake_test.go +++ b/snake_test.go @@ -54,6 +54,8 @@ func toSnake(tb testing.TB) { {"A1 A2 A3", "a_1_a_2_a_3"}, {"AB1AB2AB3", "ab_1_ab_2_ab_3"}, {"AB1 AB2 AB3", "ab_1_ab_2_ab_3"}, + {"some string", "some_string"}, + {" some string", "some_string"}, } for _, i := range cases { in := i[0]