Keep a possessive acronym in one piece in Pascal/Camel/Snake/Kebab/Macro [patch] - #93
Merged
Merged
Conversation
…cro [patch] Dropping the in-word apostrophe from "CEO's" left "CEOs", which the acronym-tail rule in IsWordBoundary split into "CE Os", so "CEO's office" became ce_os_office and "API's" became ApIs. When the apostrophe follows a capital and the letters after it are all lowercase, uppercase them, so the word is the single all-caps word "CEOS". Fixes #88 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N3tMVtLPuNwsQF7rUEBTMQ
|
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 #88
What was wrong
Since the #83 fix,
ReplaceNonAlphaNumericWithSpacedrops an in-word apostrophe, so"CEO's"became"CEOs". The acronym-tail rule inIsWordBoundary(upper, upper, lower) then broke before the last capital, which gave"CE Os". As a result,"CEO's office".ToSnakeCase()returnedce_os_officeand"API's".ToPascalCase()returnedApIs.Change
This takes the second approach the issue suggests. When
ReplaceNonAlphaNumericWithSpacedrops an in-word apostrophe that follows a capital, and every letter after it is lowercase, it uppercases those letters."CEO's"then becomes"CEOS", a single all-caps word, and every converter normalizes it the same way as"CEO".These cases are unchanged:
don't,o'neil,ceo's).DON'T,O'Neil).'quoted',80's).ToTitleCasedoes not go through this path. The matching Title Case fix for possessive acronyms is #90, in #92.Tests
New rows in
ApostropheWithinWordShouldNotSplitIt, each covering Pascal, Camel, Snake, Kebab and Macro:API's,CEO's office,the CEO's office,NASA's mission, andCEO’s office(U+2019). There is also aDON'T stopguard row, which is unchanged.With
CaseConverter.csreverted, all 5 possessive rows fail. With the change, all 71 tests pass on net10.0, and the solution builds for every target with 0 warnings.🤖 Generated with Claude Code
https://claude.ai/code/session_01N3tMVtLPuNwsQF7rUEBTMQ
Generated by Claude Code