Products | Versions |
---|---|
Spotfire Analyst | All Versions |
or
RXReplace([myString],"(^[a-z]| [a-z])","\\U$1","g")
Explanation:
RXReplace( RXReplace([myString],"(^[a-z]| [a-z])","\\U$1","g"), "(?!^)(A|An|The|This|And|But|Or|For|Nor|At|On|In|For|Since) ","\\L$1 ","g")
Note: the list of words to NOT be capitalized is located in the 3rd line of the above expression and can be edited as required.
Explanation:
Optional:
If the string to be converted is all capitals, then the above expressions will not work since they look for lower case letters to capitalize. In this case, you can use the Lower() function to convert those to lower case first and then the title case conversion will continue as expected:
RXReplace(Lower([myString]),"(^[a-z]| [a-z])","\\U$1","g")or
RXReplace( RXReplace(Lower([myString]),"(^[a-z]| [a-z])","\\U$1","g"), "(?!^)(A|An|The|This|And|But|Or|For|Nor|At|On|In|For|Since) ","\\L$1 ","g")