strcase
strcase copied to clipboard
A golang package for converting to snake_case or CamelCase
Hi, this PR is to show the behaviour change of ToCamel/ToLowerCamel as of 0.3.0. The testcase in 262f4c7eed578300626d2acf41c12f45772eb35d passes for 0.2.0 but fails with 0.3.0.
Hello, It seems that certain snake case strings are not correctly converted to their camel case equivalents, a few examples: `"k8s_version"` is converted to `"k8SVersion"`, it should be `"k8sVersion"` `"l10n_us"`...
I changed `ToCamel` to `ToPascal` and `ToLowerCamel` to `ToCamel` for better readability, because I think these terms make more sense (and are better understood by the majority of people).
If you run `ToCamel("PINEAPPLE")` I would expect the output to be `"Pineapple"`. Unexpectedly `"PINEAPPLE" is returned. As a workaround you can do `strcase.ToCamel(strings.ToLower(str))`, but it would be nice if `ToCamel`...
https://khalilstemmler.com/blogs/camel-case-snake-case-pascal-case/ Current `CamelCase` used in this library is actually supposed to be `PascalCase` Current `LowerCamelCase` is should just be `CamelCase`
When running these: ``` strcase.ToCamel("st(range)") strcase.ToCamel("st (range)") ``` I expect the result to be `StRange`. Now you get `Strange` That is strange 👻
Thoughts on adding something similar?: https://github.com/serenize/snaker/blob/a683aaf2d516deecd70cad0c72e3ca773ecfcef0/snaker.go#L100-L150 This would make it easier to use this for code generation. I.e. something like `TEST_HTTP` doesn't get converted to `TestHttp` (which isn't a go...
## Changes - Use ASCIISet, a zero dependency and zero heap allocation module for checking byte values, to reduce execution time by **~10 to 30%** (see benchmarks below) ## Benchmarks...
This is a bit confusing. I was actually reading [camel_test.go](https://github.com/iancoleman/strcase/blob/master/camel_test.go) and in the beginning I was thinking maybe there's a mistake (a typo) in the source code but later on...
Add two new functions ToCamelWithAcronyms() and ToLowerCamelWithAcronyms() that take a map[string]string of acronyms to use in place of the globally referenced value. This allows for more complex use cases where...