Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ToCamel fails if input is uppercase #39

Open
wichert opened this issue Apr 28, 2022 · 4 comments
Open

ToCamel fails if input is uppercase #39

wichert opened this issue Apr 28, 2022 · 4 comments

Comments

@wichert
Copy link

wichert commented Apr 28, 2022

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` did the right thing directly.

@gummy789j
Copy link

+1

@JonasDoe
Copy link

PINEAPPLE could be an acronym. CamelCasing is just not explicit. So there is no "right" thing.

@hlindberg
Copy link

Just tested and this works with the now current version. This ticket can be closed.

@laknoll
Copy link

laknoll commented Oct 13, 2023

This change just broke things for us. The bel package (to generate TypeScript definitions from go types uses ToCamelCase by default for type names. So far this worked nicely for types named e.g. SMSMessage, but those now get converted to Smsmessage which is not quite what we want (and broke the build of our app).

I can probably work around it, but just wanted to note that those kind of hidden behaviour changes in a minor package update can and do have unexpected consequences and side effects. A better solution would have been to add a new function for the new behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants