Repository navigation
Keep a letter after a digit in the same word in Title, Pascal and Camel case [patch] - #107
Merged
Merged
Conversation
…el case [patch] TextInfo.ToTitleCase capitalises a letter that follows a digit, so "1st place" became "1St Place" and "abc123def" became "Abc123Def", while snake_case, kebab-case and MACRO_CASE kept "1st" and "123def" whole. ToPascalCase().ToSnakeCase() therefore disagreed with ToSnakeCase(). ToTitleCase now lowers each letter that directly follows a digit after title-casing, so every converter treats digit-to-letter as part of the same word. Fixes #78 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ef5k7pqkftQmMd6x5w9xM
|
This was referenced Oct 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #78
What changed
This follows the maintainer's decision on the issue: a letter after a digit does not start a new word.
TextInfo.ToTitleCasecapitalised any letter that came straight after a digit. As a result,"1st place"became"1St Place", and Title, Pascal and Camel case disagreed with Snake, Kebab and Macro case.ToTitleCasenow runs a newLowercaseLettersAfterDigitsstep after title-casing, which lowers each letter that directly follows a digit. Everything elseTextInfodoes stays as it was, including its handling of apostrophes, punctuation and the dotted and dotless I.1st place1st Place1stPlace1st_placeabc123defAbc 123defAbc123defabc_123defmd5hashMd 5hashMd5hashmd_5hash3d model3d Model3dModel3d_modelTests
ALetterAfterADigitShouldNotStartANewWordcovers the four inputs from the issue. For each one it checks thatx.ToSnakeCase()equalsx.ToPascalCase().ToSnakeCase(), and does the same through camelCase and Title case."1St Place"where it expects"1st Place".🤖 Generated with Claude Code
https://claude.ai/code/session_015ef5k7pqkftQmMd6x5w9xM
Generated by Claude Code