From d3c8073f82dd62730ba867b82bfae13a86017c46 Mon Sep 17 00:00:00 2001 From: Ma_124 Date: Tue, 3 Jul 2018 19:52:40 +0200 Subject: [PATCH 1/8] Added license notices of Ian Coleman to each file --- LICENSE | 1 + README.md | 2 +- camel.go | 24 ++++++++++++++++++++++++ camel_test.go | 24 ++++++++++++++++++++++++ numbers.go | 24 ++++++++++++++++++++++++ snake.go | 24 ++++++++++++++++++++++++ snake_test.go | 24 ++++++++++++++++++++++++ 7 files changed, 122 insertions(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index d9e6fe3..3e87ff7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,7 @@ The MIT License (MIT) Copyright (c) 2015 Ian Coleman +Copyright (c) 2018 Ma_124, Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 4faf73a..b7e6014 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -strcase [![Build Status](https://travis-ci.org/iancoleman/strcase.svg)](https://travis-ci.org/iancoleman/strcase) [![Coverage](http://gocover.io/_badge/github.com/iancoleman/strcase?0)](http://gocover.io/github.com/iancoleman/strcase) +strcase [![Build Status](https://travis-ci.org/Ma124/strcase.svg)](https://travis-ci.org/Ma124/strcase) [![Coverage](http://gocover.io/_badge/github.com/Ma124/strcase?0)](http://gocover.io/github.com/Ma124/strcase) ======= strcase is a go package for converting string case to [snake case](https://en.wikipedia.org/wiki/Snake_case) or [camel case](https://en.wikipedia.org/wiki/CamelCase). diff --git a/camel.go b/camel.go index 80075a9..1a5d778 100644 --- a/camel.go +++ b/camel.go @@ -1,3 +1,27 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2015 Ian Coleman + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, Subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or Substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package strcase import ( diff --git a/camel_test.go b/camel_test.go index e1217a1..b62b9c4 100644 --- a/camel_test.go +++ b/camel_test.go @@ -1,3 +1,27 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2015 Ian Coleman + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, Subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or Substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package strcase import ( diff --git a/numbers.go b/numbers.go index 5aeddf3..fdf07cb 100644 --- a/numbers.go +++ b/numbers.go @@ -1,3 +1,27 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2015 Ian Coleman + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, Subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or Substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package strcase import ( diff --git a/snake.go b/snake.go index 23c7670..32ba961 100644 --- a/snake.go +++ b/snake.go @@ -1,3 +1,27 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2015 Ian Coleman + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, Subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or Substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + // Package strcase converts strings to snake_case or CamelCase package strcase diff --git a/snake_test.go b/snake_test.go index 16d0143..b1d8184 100644 --- a/snake_test.go +++ b/snake_test.go @@ -1,3 +1,27 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2015 Ian Coleman + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, Subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or Substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package strcase import ( From b39e75bb17eebb0f3f573d8788e4937c30e74c8f Mon Sep 17 00:00:00 2001 From: Ma_124 Date: Tue, 3 Jul 2018 20:24:52 +0200 Subject: [PATCH 2/8] Added ToDelimited --- others.go | 27 +++++++++++++++++++++++++++ snake.go | 17 +++++++++++------ snake_test.go | 34 +++++++++++++++++++++++++++++++++- 3 files changed, 71 insertions(+), 7 deletions(-) create mode 100644 others.go diff --git a/others.go b/others.go new file mode 100644 index 0000000..6cae65f --- /dev/null +++ b/others.go @@ -0,0 +1,27 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2018 Ma_124, + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, Subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or Substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package strcase + + diff --git a/snake.go b/snake.go index 32ba961..5bd5ef4 100644 --- a/snake.go +++ b/snake.go @@ -2,6 +2,7 @@ * The MIT License (MIT) * * Copyright (c) 2015 Ian Coleman + * Copyright (c) 2018 Ma_124, * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -31,6 +32,10 @@ import ( // Converts a string to snake_case func ToSnake(s string) string { + return ToDelimited(s, '_') +} + +func ToDelimited(s string, del uint8) string { s = addWordBoundariesToNumbers(s) s = strings.Trim(s, " ") n := "" @@ -44,16 +49,16 @@ func ToSnake(s string) string { } } - if i > 0 && n[len(n)-1] != '_' && nextCaseIsChanged { + if i > 0 && n[len(n)-1] != del && nextCaseIsChanged { // add underscore if next letter case type is changed if v >= 'A' && v <= 'Z' { - n += "_" + string(v) + n += string(del) + string(v) } else if v >= 'a' && v <= 'z' { - n += string(v) + "_" + n += string(v) + string(del) } - } else if v == ' ' { - // replace spaces with underscores - n += "_" + } else if v == ' ' || v == '_' || v == '-' { + // replace spaces/underscores with delimiters + n += string(del) } else { n = n + string(v) } diff --git a/snake_test.go b/snake_test.go index b1d8184..8a9930e 100644 --- a/snake_test.go +++ b/snake_test.go @@ -2,6 +2,7 @@ * The MIT License (MIT) * * Copyright (c) 2015 Ian Coleman + * Copyright (c) 2018 Ma_124, * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -53,7 +54,38 @@ func TestToSnake(t *testing.T) { out := i[1] result := ToSnake(in) if result != out { - t.Error("'" + result + "' != '" + out + "'") + t.Error("'" + in + "'('" + result + "' != '" + out + "')") + } + } +} + +func TestToDelimited(t *testing.T) { + cases := [][]string{ + []string{"testCase", "test@case"}, + []string{"TestCase", "test@case"}, + []string{"Test Case", "test@case"}, + []string{" Test Case", "test@case"}, + []string{"Test Case ", "test@case"}, + []string{" Test Case ", "test@case"}, + []string{"test", "test"}, + []string{"test_case", "test@case"}, + []string{"Test", "test"}, + []string{"", ""}, + []string{"ManyManyWords", "many@many@words"}, + []string{"manyManyWords", "many@many@words"}, + []string{"AnyKind of_string", "any@kind@of@string"}, + []string{"numbers2and55with000", "numbers@2@and@55@with@000"}, + []string{"JSONData", "json@data"}, + []string{"userID", "user@id"}, + []string{"AAAbbb", "aa@abbb"}, + []string{"test-case", "test@case"}, + } + for _, i := range cases { + in := i[0] + out := i[1] + result := ToDelimited(in, '@') + if result != out { + t.Error("'" + in + "' ('" + result + "' != '" + out + "')") } } } From 24e04f3d6a6627953d45914cb8960a16cda5ecd5 Mon Sep 17 00:00:00 2001 From: Ma_124 Date: Tue, 3 Jul 2018 20:31:25 +0200 Subject: [PATCH 3/8] Added screaming and doc --- snake.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/snake.go b/snake.go index 5bd5ef4..2dd744e 100644 --- a/snake.go +++ b/snake.go @@ -35,7 +35,18 @@ func ToSnake(s string) string { return ToDelimited(s, '_') } +// Converts a string to SCREAMING_SNAKE_CASE +func ToScreamingSnake(s string) string { + return ToScreamingDelimited(s, '_', true) +} + +// Converts a string to delimited.snake.case (in this case `del = '.'`) func ToDelimited(s string, del uint8) string { + return ToScreamingDelimited(s, del, false) +} + +// Converts a string to SCREAMING.DELIMITED.SNAKE.CASE (in this case `del = '.'; screaming = true`) or delimited.snake.case (in this case `del = '.'; screaming = false`) +func ToScreamingDelimited(s string, del uint8, screaming bool) string { s = addWordBoundariesToNumbers(s) s = strings.Trim(s, " ") n := "" @@ -63,6 +74,11 @@ func ToDelimited(s string, del uint8) string { n = n + string(v) } } - n = strings.ToLower(n) + + if screaming { + n = strings.ToUpper(n) + } else { + n = strings.ToLower(n) + } return n } From 04417c35f9e5d31fef07c8f3760aaccd8c35d4d2 Mon Sep 17 00:00:00 2001 From: Ma_124 Date: Tue, 3 Jul 2018 20:36:59 +0200 Subject: [PATCH 4/8] Added doc and kebab --- camel.go | 3 +++ others.go | 27 --------------------------- snake.go | 10 ++++++++++ 3 files changed, 13 insertions(+), 27 deletions(-) delete mode 100644 others.go diff --git a/camel.go b/camel.go index 1a5d778..7c2e2b7 100644 --- a/camel.go +++ b/camel.go @@ -2,6 +2,7 @@ * The MIT License (MIT) * * Copyright (c) 2015 Ian Coleman + * Copyright (c) 2018 Ma_124, * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -57,10 +58,12 @@ func toCamelInitCase(s string, initCase bool) string { return n } +// Converts a string to CamelCase func ToCamel(s string) string { return toCamelInitCase(s, true) } +// Converts a string to lowerCamelCase func ToLowerCamel(s string) string { if s == "" { return s diff --git a/others.go b/others.go deleted file mode 100644 index 6cae65f..0000000 --- a/others.go +++ /dev/null @@ -1,27 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2018 Ma_124, - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, Subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or Substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package strcase - - diff --git a/snake.go b/snake.go index 2dd744e..1d2f520 100644 --- a/snake.go +++ b/snake.go @@ -40,6 +40,16 @@ func ToScreamingSnake(s string) string { return ToScreamingDelimited(s, '_', true) } +// Converts a string to kebab-case +func ToKebab(s string) string { + return ToDelimited(s, '-') +} + +// Converts a string to SCREAMING-KEBAB-CASE +func ToScreamingKebab(s string) string { + return ToScreamingDelimited(s, '-', true) +} + // Converts a string to delimited.snake.case (in this case `del = '.'`) func ToDelimited(s string, del uint8) string { return ToScreamingDelimited(s, del, false) From 2a89e57570df1d0c09c49884b31bce03d2812d94 Mon Sep 17 00:00:00 2001 From: Ma_124 Date: Tue, 3 Jul 2018 20:51:57 +0200 Subject: [PATCH 5/8] Updated readme --- README.md | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b7e6014..1b05217 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,23 @@ -strcase [![Build Status](https://travis-ci.org/Ma124/strcase.svg)](https://travis-ci.org/Ma124/strcase) [![Coverage](http://gocover.io/_badge/github.com/Ma124/strcase?0)](http://gocover.io/github.com/Ma124/strcase) -======= +# strcase +[![Build Status](https://travis-ci.org/Ma124/strcase.svg)](https://travis-ci.org/Ma124/strcase) +[![Coverage](http://gocover.io/_badge/github.com/Ma124/strcase?0)](http://gocover.io/github.com/Ma124/strcase) +[![Godoc Reference](https://godoc.org/github.com/Ma124/strcase?status.svg)](http://godoc.org/github.com/Ma124/strcase) strcase is a go package for converting string case to [snake case](https://en.wikipedia.org/wiki/Snake_case) or [camel case](https://en.wikipedia.org/wiki/CamelCase). -# Example +## Example -``` +```go x := "AnyKind of_string" -xSnake := strcase.ToSnake(x) // any_kind_of_string -xCamel := strcase.ToCamel(x) // AnyKindOfString ``` + +| Function | Result | +|-----------------------------------|----------------------| +| `ToSnake(s)` | `any_kind_of_string` | +| `ToScreamingSnake(s)` | `ANY_KIND_OF_STRING` | +| `ToKebab(s)` | `any-kind-of-string` | +| `ToScreamingKebab(s)` | `ANY-KIND-OF-STRING` | +| `ToDelimited(s, '.')` | `any.kind.of.string` | +| `ToScreamingDelimited(s, '.')` | `ANY.KIND.OF.STRING` | +| `ToCamel(s)` | `AnyKindOfString` | +| `ToLowerCamel(s)` | `anyKindOfString` | From 9d2f0b2dc3d4448e5fbb93eb1b242d3085fcadae Mon Sep 17 00:00:00 2001 From: Ma_124 Date: Tue, 3 Jul 2018 20:53:39 +0200 Subject: [PATCH 6/8] Reformatted readme --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 1b05217..f41ef4c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # strcase +[![Godoc Reference](https://godoc.org/github.com/Ma124/strcase?status.svg)](http://godoc.org/github.com/Ma124/strcase) [![Build Status](https://travis-ci.org/Ma124/strcase.svg)](https://travis-ci.org/Ma124/strcase) [![Coverage](http://gocover.io/_badge/github.com/Ma124/strcase?0)](http://gocover.io/github.com/Ma124/strcase) -[![Godoc Reference](https://godoc.org/github.com/Ma124/strcase?status.svg)](http://godoc.org/github.com/Ma124/strcase) strcase is a go package for converting string case to [snake case](https://en.wikipedia.org/wiki/Snake_case) or [camel case](https://en.wikipedia.org/wiki/CamelCase). @@ -11,13 +11,13 @@ strcase is a go package for converting string case to [snake case](https://en.wi x := "AnyKind of_string" ``` -| Function | Result | -|-----------------------------------|----------------------| -| `ToSnake(s)` | `any_kind_of_string` | -| `ToScreamingSnake(s)` | `ANY_KIND_OF_STRING` | -| `ToKebab(s)` | `any-kind-of-string` | -| `ToScreamingKebab(s)` | `ANY-KIND-OF-STRING` | -| `ToDelimited(s, '.')` | `any.kind.of.string` | -| `ToScreamingDelimited(s, '.')` | `ANY.KIND.OF.STRING` | -| `ToCamel(s)` | `AnyKindOfString` | -| `ToLowerCamel(s)` | `anyKindOfString` | +| Function | Result | +|-----------------------------------|------------------------| +| `ToSnake(s)` | `"any_kind_of_string"` | +| `ToScreamingSnake(s)` | `"ANY_KIND_OF_STRING"` | +| `ToKebab(s)` | `"any-kind-of-string"` | +| `ToScreamingKebab(s)` | `"ANY-KIND-OF-STRING"` | +| `ToDelimited(s, '.')` | `"any.kind.of.string"` | +| `ToScreamingDelimited(s, '.')` | `"ANY.KIND.OF.STRING"` | +| `ToCamel(s)` | `"AnyKindOfString"` | +| `ToLowerCamel(s)` | `"anyKindOfString"` | From 22125ab7013888e5588dac89193aa4a025b1d211 Mon Sep 17 00:00:00 2001 From: Ma_124 Date: Tue, 3 Jul 2018 20:57:11 +0200 Subject: [PATCH 7/8] Swapped Ma124 to iancoleman in all badges for pull request --- README.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index f41ef4c..3223159 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # strcase -[![Godoc Reference](https://godoc.org/github.com/Ma124/strcase?status.svg)](http://godoc.org/github.com/Ma124/strcase) -[![Build Status](https://travis-ci.org/Ma124/strcase.svg)](https://travis-ci.org/Ma124/strcase) -[![Coverage](http://gocover.io/_badge/github.com/Ma124/strcase?0)](http://gocover.io/github.com/Ma124/strcase) +[![Godoc Reference](https://godoc.org/github.com/iancoleman/strcase?status.svg)](http://godoc.org/github.com/iancoleman/strcase) +[![Build Status](https://travis-ci.org/iancoleman/strcase.svg)](https://travis-ci.org/iancoleman/strcase) +[![Coverage](http://gocover.io/_badge/github.com/iancoleman/strcase?0)](http://gocover.io/github.com/iancoleman/strcase) strcase is a go package for converting string case to [snake case](https://en.wikipedia.org/wiki/Snake_case) or [camel case](https://en.wikipedia.org/wiki/CamelCase). @@ -11,13 +11,13 @@ strcase is a go package for converting string case to [snake case](https://en.wi x := "AnyKind of_string" ``` -| Function | Result | -|-----------------------------------|------------------------| -| `ToSnake(s)` | `"any_kind_of_string"` | -| `ToScreamingSnake(s)` | `"ANY_KIND_OF_STRING"` | -| `ToKebab(s)` | `"any-kind-of-string"` | -| `ToScreamingKebab(s)` | `"ANY-KIND-OF-STRING"` | -| `ToDelimited(s, '.')` | `"any.kind.of.string"` | -| `ToScreamingDelimited(s, '.')` | `"ANY.KIND.OF.STRING"` | -| `ToCamel(s)` | `"AnyKindOfString"` | -| `ToLowerCamel(s)` | `"anyKindOfString"` | +| Function | Result | +|-----------------------------------|----------------------| +| `ToSnake(s)` | `any_kind_of_string` | +| `ToScreamingSnake(s)` | `ANY_KIND_OF_STRING` | +| `ToKebab(s)` | `any-kind-of-string` | +| `ToScreamingKebab(s)` | `ANY-KIND-OF-STRING` | +| `ToDelimited(s, '.')` | `any.kind.of.string` | +| `ToScreamingDelimited(s, '.')` | `ANY.KIND.OF.STRING` | +| `ToCamel(s)` | `AnyKindOfString` | +| `ToLowerCamel(s)` | `anyKindOfString` | From e9c8621a63a5b25c793eb3ac1d2957d439973c25 Mon Sep 17 00:00:00 2001 From: Ma_124 Date: Tue, 3 Jul 2018 21:12:42 +0200 Subject: [PATCH 8/8] Fixed typo in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3223159..978b46d 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ strcase is a go package for converting string case to [snake case](https://en.wi ## Example ```go -x := "AnyKind of_string" +s := "AnyKind of_string" ``` | Function | Result |