Skip to content

Keep an in-word apostrophe from splitting the word in Pascal/Camel/Snake/Kebab/Macro [patch] - #85

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/83-apostrophe-in-word
Sep 28, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/83-apostrophe-in-word

Conversation

@matt-edmondson

@matt-edmondson matt-edmondson commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #83

What changed

ReplaceNonAlphaNumericWithSpace turned every apostrophe into a space, so the letters after it became a separate word. It feeds both the Pascal/Camel path and the Snake/Kebab/Macro path. Now an apostrophe (' or U+2019) with a letter on each side is dropped. An apostrophe anywhere else, such as a leading or trailing quote or 80's, still separates words.

Input Method Before After
don't stop ToPascalCase DonTStop DontStop
don't stop ToCamelCase donTStop dontStop
don't stop ToSnakeCase don_t_stop dont_stop
don't stop ToMacroCase DON_T_STOP DONT_STOP
o'neil ToPascalCase / ToSnakeCase ONeil / o_neil Oneil / oneil

ToTitleCase does not go through this helper and is unchanged. It already keeps Don't as one word.

Tests

  • ApostropheWithinWordShouldNotSplitIt covers every row in the issue for both ' and U+2019, across Pascal, Camel, Snake, Kebab and Macro. Its rows fail with the fix reverted.
  • ApostropheNotBetweenLettersShouldStillSeparateWords checks that quotes, rock 'n' roll and 80's still separate words.
  • The full suite passes (58 tests), and the solution builds for every target framework.

This branch is independent of #86 (the fix for #82), and the two merge cleanly in either order.

🤖 Generated with Claude Code

https://claude.ai/code/session_012mvcqKMc35CMobct1fmizc

…ake/Kebab/Macro [patch]

ReplaceNonAlphaNumericWithSpace turned every apostrophe into a space, so
"don't stop" became "DonTStop" and "don_t_stop", disagreeing with
ToTitleCase, which keeps "Don't" as one word. An apostrophe (' or U+2019)
with a letter on each side is now dropped instead; one anywhere else
still separates words.

Fixes #83

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012mvcqKMc35CMobct1fmizc
@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.

Pascal/Camel/Snake/Kebab/Macro split words at an apostrophe: "don't stop" → "DonTStop" / "don_t_stop"

2 participants