Keep an all-caps word containing ß in one piece, so ToMacroCase is idempotent [patch] - #94
Merged
Merged
Conversation
…empotent [patch] ToUpperInvariant leaves ß, fi and ʼn unchanged, so ToMacroCase output such as "STRAßE" still holds a lowercase letter. Converting it again split it into "STR_Aß_E", and IsAllCaps did not count it as all caps. A lowercase letter with no uppercase form now takes the case of the nearest cased letter before it for word boundaries, is skipped when looking ahead for the lowercase tail of an acronym, and is ignored by IsAllCaps. Fixes #87 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N3tMVtLPuNwsQF7rUEBTMQ
|
This was referenced Sep 28, 2026
This was referenced Sep 28, 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 #87
What was wrong
ToUpperInvariantleavesß,fiandʼnunchanged, soToMacroCaseoutput such asSTRAßEstill contains a lowercase (Ll) letter. When that output was converted again:IsWordBoundaryread theßas lowercase. The acronym-tail rule broke before theA, and the lower→upper rule broke before theE, which gaveSTR_Aß_E.IsAllCaps("STRAßE")returned false, soToTitleCasedid not normalize the word.Change
A lowercase letter that uppercasing leaves unchanged (
IsLowercaseWithNoUppercase) is now handled as follows:STRAßEdoes not break before theA.EndsWordThatIsNotUppercase).STRAßEdoes not break before theE, whilegroßFoostill breaks before theF. When no cased letter comes before it, as infiLE, it does not end a word.IsAllCaps: it is ignored. The public behaviour change:"STRAßE".IsAllCaps()is now true. A string whose only letters are such letters, such as"ß", is now vacuously all caps, the same way a string with no letters already was.This is a different problem from #84, which is about the upper→lower round trip changing lowercase letters. The triage note's possible conflicts, #85 and #86, have both merged, and this branch is on current
main.Tests
ToMacroCaseShouldBeIdempotentForLowercaseLettersWithNoUppercaseForm:x.ToMacroCase().ToMacroCase() == x.ToMacroCase()forstraße,maßnahmeLimit,MAX_GRÖßEandfile.AnAllCapsWordContainingSharpSShouldStayOneWord: every example from the issue (STRAßE→straße,Straße,Straße;MAßNAHME→maßnahme;MAX_GRÖßE→maxGröße; and so on).ALowercaseWordEndingInSharpSShouldStillSplitBeforeACapital:großFoo→groß_foo. This guard passes before and after the change.IsAllCapsShouldIgnoreLowercaseLettersWithNoUppercaseFormWith
CaseConverter.csreverted, 5 of the new tests fail. With the change, all 72 tests pass on net10.0, and the solution builds for every target with 0 warnings.🤖 Generated with Claude Code
https://claude.ai/code/session_01N3tMVtLPuNwsQF7rUEBTMQ
Generated by Claude Code