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

[feature] Option to treat consecutive uppercase characters in PascalCase as separate words #36

Open
junbl opened this issue Mar 31, 2022 · 2 comments

Comments

@junbl
Copy link

junbl commented Mar 31, 2022

From the docs:

That is, “HelloWorld” is segmented Hello|World whereas “XMLHttpRequest” is segmented XML|Http|Request.

I have identifiers with single character words in them. I'd love it if they were snake_cased as separate words, e.g.:

assert_eq!("ABCD".to_snake_case_from_pascal_case_strict() == "a_b_c_d")
assert_eq!("ABCcD".to_snake_case_from_pascal_case_strict() == "a_b_cc_d")

This would be the exact inverse of to_pascal_case() for snake_case text, i.e.:

assert_eq!(text.to_snake_case().to_pascal_case().to_snake_case_from_pascal_case_strict() == text.to_snake_case())

Plaground link

@azaleacolburn
Copy link

I suppose that option can be added, not sure how much the maintainer will care to merge it though.

@jplatte
Copy link
Collaborator

jplatte commented Aug 15, 2023

This could be supported by the API I descibed in #18 (comment).

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

3 participants