What's wrong
Commit 5c15077 (#83) keeps an in-word apostrophe from splitting a word in Pascal, Camel, Snake, Kebab and Macro. That only works when the letter after the apostrophe is lowercase. When it is uppercase, as in the usual spelling of names like "O'Neil" and "D'Angelo", the word is still split.
Reproduced (net10.0):
| Input |
Pascal |
Camel |
Snake |
Kebab |
Macro |
Title |
O'Neil |
ONeil |
oNeil |
o_neil |
o-neil |
O_NEIL |
O'neil |
o'neil |
Oneil |
oneil |
oneil |
oneil |
ONEIL |
|
O'NEIL |
Oneil |
|
oneil |
|
|
|
D'Angelo |
|
|
d_angelo |
|
|
|
d'angelo |
|
|
dangelo |
|
|
|
Don'T |
|
|
don_t |
|
|
Don't |
Expected: O'Neil gives Oneil, oneil, oneil, oneil and ONEIL. That matches o'neil and O'NEIL, and matches ToTitleCase, which already treats it as the one word "O'neil".
Why it happens
In CaseConverter/CaseConverter.cs:
ReplaceNonAlphaNumericWithSpace / IsApostropheWithinWord (~lines 42–82) drop the in-word apostrophe, so "O'Neil" becomes "ONeil".
SplitOnCaseChange / IsWordBoundary (~lines 109–171) then run on the joined text. The acronym-tail rule (upper, upper, then lower, ~lines 151–153) breaks before the "N".
- The "don't split after an apostrophe" check (~lines 156–158) can never fire, because the apostrophe is already gone by then.
Why it matters
Suggested fix
Either of these:
- When an in-word apostrophe is dropped, lowercase the letter that follows it, so no case transition is left behind.
- Or run the case-change split while the apostrophe is still in the string, and treat letter +
' + letter as a single word. The rule at ~line 158 already declines to break after an apostrophe.
Acceptance criteria
What's wrong
Commit 5c15077 (#83) keeps an in-word apostrophe from splitting a word in Pascal, Camel, Snake, Kebab and Macro. That only works when the letter after the apostrophe is lowercase. When it is uppercase, as in the usual spelling of names like "O'Neil" and "D'Angelo", the word is still split.
Reproduced (net10.0):
O'NeilONeiloNeilo_neilo-neilO_NEILO'neilo'neilOneiloneiloneiloneilONEILO'NEILOneiloneilD'Angelod_angelod'angelodangeloDon'Tdon_tDon'tExpected:
O'NeilgivesOneil,oneil,oneil,oneilandONEIL. That matcheso'neilandO'NEIL, and matchesToTitleCase, which already treats it as the one word "O'neil".Why it happens
In
CaseConverter/CaseConverter.cs:ReplaceNonAlphaNumericWithSpace/IsApostropheWithinWord(~lines 42–82) drop the in-word apostrophe, so "O'Neil" becomes "ONeil".SplitOnCaseChange/IsWordBoundary(~lines 109–171) then run on the joined text. The acronym-tail rule (upper, upper, then lower, ~lines 151–153) breaks before the "N".Why it matters
x.ToTitleCase().ToSnakeCase()differs fromx.ToSnakeCase():"o'neil"givesoneil, while"O'Neil"giveso_neil.Suggested fix
Either of these:
'+ letter as a single word. The rule at ~line 158 already declines to break after an apostrophe.Acceptance criteria
"O'Neil"and"Don'T"produce the same Pascal/Camel/Snake/Kebab/Macro output as their lowercase spellings."o'neil"row inCaseConverterTests.cs(~line 412).