Jump to content

Changing color of returned text?


NPN

Recommended Posts

Hi,

 

This is probably real simple, I've tried different code snippets from the forums, but can't get it working.

 

I have a rule that formats a phone number, it also adds an "|" in front of the number. I need to change the font color of only the "|" to grey(a color I have defined) and leave the rest(or keep it black).

 

Here's the code I use:

 


var phone = ReplaceSubstring(Field("Direct"), " ", "")

if (phone=="") {
 return "";
}

if (phone.length < 8) {
return phone;
}

var lengde = phone.length-7;

var phone8 = Mid(phone,lengde,8);

switch (phone)
{
   default:

       var p1 = Mid(phone8, 1, 2)        
       var p2 = Mid(phone8, 3, 2)        
       var p3 = Mid(phone8, 5, 2)        
       var p4 = Mid(phone8, 7, 2)        
       return "| Direct " + p1 + " " + p2 + " " + p3 + " " + p4 ;
}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...