Keep a plural acronym in one piece: "APIs" no longer splits as "AP Is" [patch] - #102
Merged
Merged
Conversation
…" [patch] The acronym-tail rule breaks before the last capital of an uppercase run when a lowercase letter follows it, so that "XMLDoc" becomes "XML Doc". It also fired on a plural acronym, where the lowercase letter is only the plural "s", so "getIDs" became "get_i_ds". Don't break when that lowercase run is a lone "s" ending the word: followed by the end of the string, a non-letter or a capital. "HTTPServer" still splits. Fixes #99 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AtF6Ynq3K6Km6HSRHaKuX8
matt-edmondson
force-pushed
the
fix/99-plural-acronyms
branch
from
September 29, 2026 20:31
fddb9e4 to
3346f98
Compare
|
This was referenced Sep 30, 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 #99
What changed
IsWordBoundaryhas an acronym-tail rule: it breaks before the last capital of an uppercase run when a lowercase letter follows it, soXMLDocbecomesXML Doc. The rule also fired on plural acronyms, where that lowercase letter is just the plurals.A new
IsPluralSuffixcheck exempts a lonesthat ends its word. The word ends when thesis followed by the end of the string, a non-letter, or a capital. A longer lowercase run is still a real word, soHTTPServer,HTMLParser,ABCdefandIOStreamsplit exactly as before.APIsToSnakeCase()ap_isapisURLsToPascalCase()UrLsUrlsgetIDsToSnakeCase()get_i_dsget_idsthe URLs listToTitleCase()The Ur Ls ListThe Urls ListPDFsAndDOCsToSnakeCase()pd_fs_and_do_cspdfs_and_docsThis also brings the plural in line with the possessive form fixed in #93, where
API'salready givesapis.Testing
APluralAcronymShouldStayOneWordcovers every input from the issue, plusGUIDs_2, across Pascal, Camel, Snake, Kebab, Macro and Title.AnAcronymFollowedByAWordShouldStillSplitpins the boundary:HTTPServer,XMLDoc,HTMLParser,ABCdef,IOStreamandURLsList.dotnet build CaseConverter.slnbuilds every target (net10.0/9.0/8.0, netstandard2.0/2.1) with 0 warnings.🤖 Generated with Claude Code
https://claude.ai/code/session_01AtF6Ynq3K6Km6HSRHaKuX8
Generated by Claude Code