Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Split camel case phrases into separate words
| ResourceFunction["FromCamelCase"]["string"] inserts spaces into string to convert camel case phrases into separate words. | 
| ToLowerCase | False | whether words after the first word are changed to lower case | 
| “SingleLetterWords" | False | whether sequences of capital letters should be separated as words | 
| "KnownWords" | {} | words to treat as complete before the camel case is analyzed | 
| IgnoreCase | False | whether "KnownWords" must match case | 
Wolfram Language built-in symbols are always written in camel case:
| In[1]:= | ![ResourceFunction["FromCamelCase"]["ListLinePlot"]](https://www.wolframcloud.com/obj/resourcesystem/images/723/723f5750-1117-47e4-a034-d6233eb71ca1/78bffaa8d58830cb.png) | 
| Out[1]= |  | 
The option ToLowerCase will also put all but the first word into lower case:
| In[2]:= | ![ResourceFunction["FromCamelCase"]["ListLinePlot", ToLowerCase -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/723/723f5750-1117-47e4-a034-d6233eb71ca1/109440f6b81e068b.png) | 
| Out[2]= |  | 
Blocks of capitals are considered part of the same word:
| In[3]:= | ![ResourceFunction["FromCamelCase"]["NDSolveValue"]](https://www.wolframcloud.com/obj/resourcesystem/images/723/723f5750-1117-47e4-a034-d6233eb71ca1/738193705803e0f3.png) | 
| Out[3]= |  | 
Use "SingleLetterWords"→True to change this:
| In[4]:= | ![ResourceFunction["FromCamelCase"]["NDSolveValue", "SingleLetterWords" -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/723/723f5750-1117-47e4-a034-d6233eb71ca1/396e69f61785996e.png) | 
| Out[4]= |  | 
Use "KnownWords" for groups of letters that should be treated as a single word, such as acronyms:
| In[5]:= | ![ResourceFunction["FromCamelCase"]["APIFunction", "KnownWords" -> {"API"}]](https://www.wolframcloud.com/obj/resourcesystem/images/723/723f5750-1117-47e4-a034-d6233eb71ca1/09b0e106380d783f.png) | 
| Out[5]= |  | 
"KnownWords" should match the same case:
| In[6]:= | ![ResourceFunction["FromCamelCase"]["APIFunctionapi", "KnownWords" -> {"API"}]](https://www.wolframcloud.com/obj/resourcesystem/images/723/723f5750-1117-47e4-a034-d6233eb71ca1/35db8c883f71e905.png) | 
| Out[6]= |  | 
But if IgnoreCase is used, "KnownWords" will match in any case but will return the capitalization given in "KnownWords":
| In[7]:= | ![ResourceFunction["FromCamelCase"]["APIFunctionapi", "KnownWords" -> {"APi"}, IgnoreCase -> True]](https://www.wolframcloud.com/obj/resourcesystem/images/723/723f5750-1117-47e4-a034-d6233eb71ca1/0d12d337056dfc14.png) | 
| Out[7]= |  | 
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License