Repository navigation
Split a single capital after a digit before an apostrophe in every converter [patch] - #162
Merged
matt-edmondson merged 3 commits intoNov 11, 2026
Merged
Conversation
…nverter [patch]
"4K's price" gave snake "4ks_price" but Title "4 K's Price", whose snake is
"4_ks_price", so converting through Title case changed the words.
Before an in-word apostrophe, ReplaceNonAlphaNumericWithSpace uppercased the
suffix onto the capital ("4KS"). After a digit that read as an all-caps run,
which IsWholeCapitalRun keeps in the digit's word. Title case keeps the
apostrophe, saw a single capital, and broke before it. The suffix is now left
lowercase when the capital directly follows a digit or a caseless letter, so
every converter matches the no-apostrophe behaviour: snake "4_ks_price",
Pascal "4KsPrice", Title "4 K's Price". Runs of two or more capitals
("4KB's") and digit plurals ("the 1990's") are unchanged.
Fixes #161
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW4bh3rDc6opLckXQGb
This was referenced Nov 5, 2026
…ter-digit-apostrophe-161 # Conflicts: # CaseConverter/CaseConverter.cs
…ter-digit-apostrophe-161 # Conflicts: # CaseConverter/CaseConverter.cs
|
matt-edmondson
deleted the
fix/single-capital-after-digit-apostrophe-161
branch
November 11, 2026 02:29
This was referenced Nov 11, 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 #161
What was wrong
"4K's price"gave snake4ks_pricebut Title4 K's Price, and the snake case of that Title output is4_ks_price. So converting through Title case changed the words.Before an in-word apostrophe,
ReplaceNonAlphaNumericWithSpaceuppercased the suffix onto the capital, giving4KS. After a digit, that reads as an all-caps run, andIsWholeCapitalRunkeeps such a run in the digit's word. Title case keeps the apostrophe, so it sees a single capital and breaks before it.Change
The suffix is now left lowercase when the capital directly follows a digit or a caseless letter (new helper
IsSingleCapitalAfterDigitOrCaselessLetter). Caseless letters are included becauseIsWordBoundarytreats them the same way. Every converter now matches the no-apostrophe behaviour, which is the first option in the issue:4K's price4_ks_price4 K's Price4KsPrice3D's model3_ds_model3 D's Model3DsModelB2B's growthb_2_bs_growthB 2 B's GrowthB2BsGrowthRuns of two or more capitals (
4KB's) and digit plurals (the 1990's,4's and 5's) are unchanged.Tests
ASingleCapitalAfterADigitBeforeAnApostropheShouldSplitTheSameEverywhere. It covers the issue's three rows plus a U+2019 row and4K'ers. Each row checks Title, Pascal, camel, snake and MACRO, and also checkssnake == Title→snake == Pascal→snake == camel→snake.AnApostropheAfterADigitWordShouldKeepConvertersAgreeing. It is an invariant-only guard for4KB's size,名K's list,the 1990'sand4's and 5's.名K's list.dotnet build CaseConverter.slnbuilds every target with no warnings.The open PR #160, which touches the apostrophe handling in the same file, is a separate change. The two may need a trivial rebase, depending on which lands first.
Generated by Claude Code