Skip to content

Keep a possessive after a lowercased all-caps run in the same word [patch] - #136

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/135-possessive-after-lowercased-caps
Oct 30, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/135-possessive-after-lowercased-caps

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #135

What changed

"d'ARTAGNAN's sword" became dartagnan_s_sword, and "o'NEIL's" became oneil_s. The first apostrophe lowercases the capital run (#128). The second apostrophe then saw the uppercase N in the original input and uppercased the s, so SplitOnCaseChange broke it off as a separate word.

In the apostrophe branch of ReplaceNonAlphaNumericWithSpace, uppercaseSuffix is now guarded with !lowercaseSuffix. The guard reads the flag from the previous apostrophe, before it is reassigned. A run that is already being lowercased no longer uppercases the suffix after it.

Tests

  • Added ApostropheWithinWordShouldNotSplitIt rows for d'ARTAGNAN's sword, o'NEIL's and o’NEIL’s (typographic apostrophe), checked against pascal, camel, snake, kebab and macro. The rows D'Artagnan's sword and O'Neil's were added next to them as the expected-equal spellings.
  • Before the fix, the three new lowercase-particle rows fail. With the fix, all 201 tests pass on net10.0.
  • dotnet build CaseConverter.sln succeeds for every target framework with no warnings.

Generated by Claude Code

…atch]

"d'ARTAGNAN's sword" became "dartagnan_s_sword" and "o'NEIL's" became
"oneil_s". The first apostrophe lowercases the capital run (#128), but the
second apostrophe saw the capital N before it and uppercased the "s", which
the case-change splitter then broke off. A run that is already being
lowercased no longer uppercases the suffix after it, so both now convert
like "D'Artagnan's sword" and "O'Neil's".

Fixes #135

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW5r5WL5w6Xw9zvRF9a
@matt-edmondson
matt-edmondson force-pushed the fix/135-possessive-after-lowercased-caps branch from 692889c to 119bc66 Compare October 29, 2026 04:27
@sonarqubecloud

Copy link
Copy Markdown

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.

"d'ARTAGNAN's sword".ToSnakeCase() gives "dartagnan_s_sword" and "o'NEIL's" gives "oneil_s": the #128 fix moved the split to the second apostrophe

2 participants