Normalize an all-caps word joined by '-', '.' or a tab in ToTitleCase [patch] - #86
Merged
Merged
Conversation
… [patch] LowercaseAllCapsWords split only on spaces, but TextInfo.ToTitleCase also treats '-', '.' and tabs as word boundaries and keeps an all-caps word it finds there. So "foo-BAR" became "Foo-BAR" while "FOO-BAR" became "Foo-Bar". It now lowercases each all-caps run of letters and apostrophes, which is what TextInfo treats as a word. Fixes #82 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012mvcqKMc35CMobct1fmizc
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012mvcqKMc35CMobct1fmizc
|
This was referenced Sep 28, 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 #82
What changed
LowercaseAllCapsWordssplit its input only on' '.TextInfo.ToTitleCasealso treats-,.and tabs as word boundaries, and it keeps any all-caps word it finds as an acronym. So an all-caps segment inside a space-delimited token that also had lowercase letters was never lowercased first.It now lowercases each maximal run of letters and apostrophes that is entirely uppercase. That is the unit
TextInfotreats as a word, so each word converts the same way whatever sits next to it.foo-BARFoo-BARFoo-BarFOO-BARFoo-BarFoo-BarAPI-keyAPI-KeyApi-Keyfoo.BARFoo.BARFoo.BarHELLO\tworldHELLO\tWorldHello\tWorldHELLO worldHello WorldHello WorldApostrophes count as part of a word, so
DON'T stopstill becomesDon't Stop.Tests
ToTitleCaseShouldNormalizeAllCapsWordsJoinedByPunctuationOrTabscovers every row in the issue plusDON'T stop. With the fix reverted, exactly the four broken rows fail.ToTitleCasetests, including the punctuation cases from d8bdab2, still pass. The full suite passes (57 tests), and the solution builds for every target framework.This branch is independent of #85 (the apostrophe fix for #83). The two PRs touch different helpers in
CaseConverter.csand merge cleanly in either order.🤖 Generated with Claude Code
https://claude.ai/code/session_012mvcqKMc35CMobct1fmizc
Generated by Claude Code