Skip to content

Title Case transform: recognize camelCase word boundaries#308699

Open
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:feat/title-case-camelcase-boundaries
Open

Title Case transform: recognize camelCase word boundaries#308699
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:feat/title-case-camelcase-boundaries

Conversation

@yogeshwaran-c
Copy link
Copy Markdown
Contributor

Summary

Fixes #168979

The "Transform to Title Case" command now recognizes camelCase word boundaries before applying the transformation. Previously, SrecParserLoadFromFile would be lowercased to srecparserloadfromfile and then only the first letter would be capitalized, producing Srecparserloadfromfile. Now it correctly produces Srec Parser Load From File.

The implementation reuses the same caseBoundary and singleLetters regex patterns already used by SnakeCaseAction to detect camelCase transitions (lowercase-to-uppercase and acronym boundaries like HTMLString). Before lowercasing and applying the title boundary regex, the text is first split at camelCase boundaries by inserting spaces.

Examples:

Input Before After
SrecParserLoadFromFile Srecparserloadfromfile Srec Parser Load From File
parseHTMLString Parsehtmlstring Parse Html String
getElementById Getelementbyid Get Element By Id
camelCaseWord Camelcaseword Camel Case Word
hello world Hello World Hello World (unchanged)

Test plan

  • Updated existing title case tests for new camelCase-aware behavior
  • Added new test cases for camelCase identifiers (SrecParserLoadFromFile, parseHTMLString, getElementById, XMLHttpRequest, camelCaseWord, simple)
  • Verified compile check passes (npm run compile-check-ts-native)
  • Run unit tests via scripts/test.sh

The 'Transform to Title Case' command now splits camelCase identifiers
at word boundaries before applying title case. For example,
'SrecParserLoadFromFile' is now correctly transformed to
'Srec Parser Load From File' instead of 'Srecparserloadfromfile'.

This reuses the same caseBoundary and singleLetters regex patterns
from SnakeCaseAction to detect camelCase transitions.

Fixes microsoft#168979
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conversion from Camel Case to Title Case does not work

2 participants