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

Problem in Camelize method #1397

Open
Nefcanto opened this issue Feb 17, 2024 · 4 comments
Open

Problem in Camelize method #1397

Nefcanto opened this issue Feb 17, 2024 · 4 comments

Comments

@Nefcanto
Copy link

Simply run this code:

var kebabed = "some-text-here";
var camelized = kebabed.Camelize();
Console.WriteLine(camelized);
// prints some-text-here instead of someTextHere

var dotted = "some.text.here";
var camelized = dotted.Camelize();
Console.WriteLine(camelized);
// prints some.text.here instead of someTextHere

@SimonCropp
Copy link
Collaborator

@hazzik @hangy @MehdiK any opinions on what should be the correct behavior in this scenario

@Nefcanto
Copy link
Author

@SimonCropp, I have also reported #1282.

The point is, the camelCasing, PascalCasing, kebab-casing, and snake_casing conventions are clear. The source should be converted into the target. In the camelCasing convention, you should only see alphanumeric characters, and no hyphens or underline should exist between words.

@lizapradhan-xpo
Copy link

@Nefcanto , I have a suggestion for such conversion.

Can we pass an extra parameter for Camelize() or any other such function named separator? So, on the basis of the separator also, the string can be converted to any case.

@Nefcanto
Copy link
Author

@lizapradhan-xpo, I think that is not a good choice. Because camelCasing is a well defined casing. There is no need for extra parameters.

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

Successfully merging a pull request may close this issue.

3 participants