#1
|
|||
|
|||
![]()
Hello all,
I am trying to create a rule that will do two things if possible. This is really an email rule. I would like to format the email address to capitalize the first letter of both the first and last name... second, I would like the rule to search for a specific character in the email field, for example a hyphen (-), and then capitalize the first letter after the hyphen. I thought this would have been discussed, but I haven't been able to find a thread mentioning this. Please let me know if this is possible. Example: AnY.character-CAP@help.com to: Any.Character-Cap@help.com Thank you! Last edited by TroyM68; April 19th, 2017 at 06:06 PM.. |
#2
|
|||
|
|||
![]()
I came up with a code:
Code:
// Build a string of the letters A through Z s = "my.name-cms@google-analytics.com" var a = "" var b = Len(s) var passedAtSign = 0 var printUpperChr = 0 for (c = 0; c < b; c++) { // checks to see if we are passed our @ sign if (Mid(s, c+1 ,1)=="@") passedAtSign = 1 // Upper case 1st character of email if (c==0) a = a + ToUpper(Mid(s, c+1 ,1)) else { // if after 1st pass it's a period or dash, // toggle printUpperChr should be set to 1 // and if not passed the @ sign, passedAtSign // should still be 0 at this point if (printUpperChr == 1 && passedAtSign==0) a = a + ToUpper(Mid(s, c+1 ,1)) else a = a + ToLower(Mid(s, c+1 ,1)) //flags to print next character upper if (Mid(s, c+1 ,1)=="." || Mid(s, c+1 ,1)=="-") printUpperChr = 1 else printUpperChr = 0 } } return a; My.Name-Cms@google-analytics.com Hopes this helps.... Last edited by tou; June 28th, 2016 at 12:28 PM.. |
#3
|
|||
|
|||
![]()
Tou,
This worked perfectly, Thank you! |
![]() |
Tags |
email, hyphenated-name |
Thread Tools | Search this Thread |
Display Modes | |
|
|