Jump to content

rules question


Recommended Posts

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

Unknown.png.1bef2ce838f521aa147d483c5fe56441.png

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...