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

ToCamelCase handles spaces as word connector #45

Closed
Ilyes512 opened this issue Jan 11, 2020 · 1 comment
Closed

ToCamelCase handles spaces as word connector #45

Ilyes512 opened this issue Jan 11, 2020 · 1 comment

Comments

@Ilyes512
Copy link

Shouldn't the ToCamelCase handle spaces?

When you use hello world as the input to ToCamelCase you get Hello world. I was expecting to see HelloWorld instead. Looking at ToKebab and ToSnakeCase I did get the expected results: hello-world and hello_world .

One way I can get the behaviour I want is to do ToCamelCase(toSnakeCase("hello world")).

@huandu
Copy link
Owner

huandu commented Jan 12, 2020

It's an undefined behavior in ToCamelCase. As this function was designed for variable name conversion, e.g. get_key to GetKey, space is not expected in the source string.

We can define this behavior just like what you suggested. See #1 for new rules.

@huandu huandu changed the title ToCamelCase spaces ToCamelCase handles spaces as word connector Jan 12, 2020
@huandu huandu closed this as completed in 73cc880 Jan 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants