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]:= |
| Out[1]= |
The option ToLowerCase will also put all but the first word into lower case:
| In[2]:= |
| Out[2]= |
Blocks of capitals are considered part of the same word:
| In[3]:= |
| Out[3]= |
Use "SingleLetterWords"→True to change this:
| In[4]:= |
| Out[4]= |
Use "KnownWords" for groups of letters that should be treated as a single word, such as acronyms:
| In[5]:= |
| Out[5]= |
"KnownWords" should match the same case:
| In[6]:= |
| Out[6]= |
But if IgnoreCase is used, "KnownWords" will match in any case but will return the capitalization given in "KnownWords":
| In[7]:= |
| Out[7]= |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License