Transform a string between various cases.
Included case transformations:
camelCaseCapital CaseCONSTANT_CASE(akaMACRO_CASE)dot.caseHeader-Case(akaTrain-Case)lower caselower Firstno casekebab-case(akaparam-case)KEBAB-UPPER-CASEPascalCasePascal_Snake_Casepath/caserAndOm cAsE(akasPonGE cAsE)Sentence casesnake_casesWAP cASETitle CaseUPPER CASEUpper first
By default, cases do not automatically pre-lowercase the text. This means that an input of THIS IS A TEST SENTENCE does not get modified when transforming to sentence case, title case, among others. This is an intentional design choice by the author of the library that this extension uses internally, change-case.
Basically, the library doesn't pre-lowercase the text is because:
- Words like
iPhoneandNASAwould be transformed intoiphoneandnasa, which is generally not the desired behavior. It's not possible to include these words as a built-in library exception because there are too many exceptions to account for. - The library is also intended for context-aware conversion between cases, eg from snake case to sentence case. For example,
hereAreSomeWordstoHere are some words. If the text was pre-lowercased, the transformation would result inherearesomewords, which is not the desired output.
See the relevant GitHub issues for more information:
If you would like to pre-lowercase the text before transforming it, you can disable the Preserve Casing preference (enabled by default) in the extension settings. This lowercases all text input before every transformation. Additionally, context-aware transformations, (mentioned above) will stop working when this setting is enabled.
For more information, please see:
You can add custom exceptions to the list of words that should not be modified when transforming the text to title case or sentence case. This is useful for words like iPhone and NASA that should not be lowercased when transforming text.
It also always includes these words.