Jump to content

Help with a rule


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.0d60daebfee97f13f247cc233fee1de8.png

Link to comment
Share on other sites

  • 4 weeks later...

Try this:

// This function goes in the rule or in JavaScript Globals:
function ToLowerCase(string, leaveAllCapsWords)
{
   function WordToLowerCaseUnicode(word)
   {
       if (leaveAllCapsWords && word == word.toUpperCase())
           return word;
       //else
       return word.toLowerCase();
   }

   return String(string).replace(/\S+/g, WordToLowerCaseUnicode);
}

// Usage:
return ToLowerCase("Spécialiste en services financiers, PME", true);
// OR:
return ToLowerCase(Field("Your Field Name"), true);

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...