drewsimmons Posted June 4, 2014 Share Posted June 4, 2014 Hello all Im just trying to figure out how to create a rule that changes text to lower case but keeps acronyms in a job title all CAPS. I have attached a jpg with the example. The title in french is Spécialiste en services financiers, PME that info is pulled into the start of the paragraph which I applied a rule applied that changes it the entire Title to lowercase But I need the PME to remain all caps any help would be greatly appricated thanks Drew Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted June 4, 2014 Share Posted June 4, 2014 I'm not sure why you want to take a proper name and remove all capitalization from it. Anyway, as for the more general question of how to exempt certain words and phrases from capitalization rules, that's is one of the most frequently asked questions on this forum. Searching this forum for "title case" or "proper case" or "totitlecase" returns lots of threads like this: http://forums.pti.com/showthread.php?t=2731 Also, things get a bit tricky with JavaScript and Regular Expressions for accented characters outside the Latin-1 (English) range, so it's even harder to come up with a solution that works correctly for your example French string. However, in your specific case, you might be able to do something like this: var title = Field("Title"); // e.g. "Spécialiste en services financiers, PME" return title.replace(/\S+/g, function(word) { return (word == word.toUpperCase()) ? word : word.toLowerCase(); } ); That will leave any whole word that's already in all uppercase alone, and convert everything else to lower-case. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.