How to get someones initials from their email address

1
Hi all,   Does anyone know how I could trim an email address to just get the initials from the string?   For example our business email addresses are always first.lastname so like this “John.Doe@Test.com” so I would like to get back the value of “JD”.   If anyone knows how to do this or has done this before it would be really useful, thanks.
asked
3 answers
1

Hi Nathan,

 

Create a variable to find the last name’s first letter’s position --find($entity/attribute, '.')

Create another variable to get the First letter of the first and last name --substring($entity/attribute, 0, 1)+substring($entity/attribute, $variable+1,1)

 

Hope it helps.

 

answered
0

Hi Nathan,

 

I would do it in this way:

Create variable integer with which you will count where the ‘.’ is and add value 1, so you have the place of the first letter of the second name. Let’s name it with ‘Count’. e.g. find($Person/Email, '.') + 1

 

Then I will create string variable where you will find your result.

($Person/Email,0,1) to get first letter and then that variable plus ($Person/Email,FindPiriot,1)

 

 

I hope this can help you.

Kind regards,
Domagoj

answered
0

If you have the Community Commons module installed you can use a simple regular expression in the RegexReplaceAll action. This supports using captured groups in the string replacement so you just look for those two initial characters and put the matches into the replacement. For example, the following will return the string ‘JD’.

answered