Skip to content

Lower a capital whose word has no other cased letter after a one-letter word [patch] - #172

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/caseless-after-one-letter-171
Nov 10, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/caseless-after-one-letter-171

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #171

What changed

LowercaseOneLetterWordsAfterOneLetterWords lowers a one-letter word that comes after another one-letter word (#95). Y名 doesn't count as a one-letter word, so its capital stayed. Joined, "Vector X Y名" became VectorXY名. That reads back as the all-caps word XY名, and a second pass turned it into VectorXy名.

There is a new check, IsCapitalThenUncased, for a word whose only cased letter is its leading capital. When such a word comes after a capital one-letter word, it is now lowered, following the existing IsLetterThenPluralS branch.

Input Pascal before → after Camel before → after
vector x y名 VectorXY名 → VectorXy名 vectorXY名 → vectorXy名
x y名前 XY名前 → Xy名前 xY名前 → xy名前
a B名 AB名 → Ab名 aB名 → ab名

The ASCII control vector x y → VectorXy is unchanged. Digit-suffixed inputs give the same output as before, because digits split into their own word earlier: vector x y2 → VectorXy2, get x y_2 → GetXy2.

Tests

AOneLetterWordBeforeACapitalAndCaselessLettersShouldConvertToOutputThatConvertsBackToItself covers the issue's five inputs plus the ASCII control. For each one it checks:

  • Pascal and camel output
  • that converting the output again gives the same result
  • that ToPascalCase().ToSnakeCase() and ToCamelCase().ToSnakeCase() agree

With the fix reverted, the five issue rows fail and the control passes. With the fix, the full suite passes: 279/279.

Note

The open splitter PRs (#160, #162–#164, #168–#170) change other parts of CaseConverter.cs. This PR is based directly on main.


Generated by Claude Code

…er word [patch]

"vector x y名" became "VectorXY名", which reads back as the all-caps word
"XY名" and converted to "VectorXy名" on a second pass. "Y名" is not a
one-letter word, so the #95 rule left its capital alone. After a capital
one-letter word, a word whose only cased letter is its leading capital is
now lowered too, so Pascal and camel output converts back to itself.

Fixes #171

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW6Z37eT9vMfVTZhXgK
@sonarqubecloud

sonarqubecloud Bot commented Nov 8, 2026

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 14eabec into main Nov 10, 2026
15 checks passed
@matt-edmondson
matt-edmondson deleted the fix/caseless-after-one-letter-171 branch November 10, 2026 23:52
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.

ToPascalCase/ToCamelCase aren't idempotent when a one-letter word is followed by Han, kana or Hangul: "vector x y名" → VectorXY名 → VectorXy名

2 participants