Skip to content

str: improve {is,}title impl and add tests #827

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

Merged
merged 2 commits into from
Apr 14, 2019
Merged

Conversation

OddCoincidence
Copy link
Contributor

The existing implementation didn't actually title-case, it just naively capitalized the first letter of each word. Also note that this is still not 100% on-par with cpython because it doesn't handle unicode titlecase characters, e.g. digraphs that consist of an uppercase and a lowercase letter. It looks like rust used to support this on nightly but removed it because they couldn't add corresponding methods on strings without a unicode-segmentation dependency. I'll see if I can extract that support into its own crate.

Also note that I added the tests as rust unit tests; this is getting significantly less painful with recent refactors and I think we should do it more.

@coolreader18 coolreader18 merged commit 8f3319e into master Apr 14, 2019
@windelbouwman windelbouwman deleted the joey/titlecase branch April 24, 2019 07:53
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 this pull request may close these issues.

2 participants