How to convert names to email adresses

studio

#1

I have a list of names, which I want to convert to email adresses.

Input of names (example names):
Barack Obama
Jack Barker
George W. Bush

Desired output of email adresses:
barack.obama@example.com
jack.barker@example.com
george.bush@example.com

I have used the replace function to replace " " with "."
Then I add @example.com at the end as it is standard.

The problem occurs when names such as George W. Bush appear. The output will then be:
george.w..bush@example.com which is wrong.

So all names which contains an abbreviation will cause the wrong output. Anyone knows how to deal with that issue and output the correct email adress as stated above?


#2

Hi @skandi,

If the names like Geoge W. Bush you should apply your predefined rule to replace such type of strings to address.
You can remove any special character in the string before it is going for final trim.
Please give the above inputs in the input dialogue in my solution. you will get the desired output.

Here you go for my solution for the above scenario. Hope you will understand.

Thanks,
GirishMain.xaml (14.6 KB)


#3

Hi @Girish,

Thanks for your answer! I tested your file and it worked fine.
But it will only apply to the name George W. Bush, and not other names such as John F. Kennedy. Because you use this function with the character ‘w’:
ThirdCharacter.replace(“w…”,".")

In my process new names could be added all the time, so then I need to have a function which takes that variable into account.

I think I need to replace the ‘w’ character with some variable, but I am not sure how to make the robot recognize the abbreviation. It could use the “…” as a reference, and remove the character before the “…”

Any idea?

Edit: for some reason when I write two dots in this text editor, it posts three dots. So all “…” means two dots.


#4

Main.xaml (13.3 KB)


Index was outside the bounds of the array
#5

The above code is working as you expected


#6

Thank you @MahalingPatil . It works as intended :slight_smile: Not really sure why, but I’ll take a closer look at the split function.


#7

what is the problem you are facing?? what type of input you are giving??


#8

Hi guys!

Great solution @MahalingPatil!
But since i have already created a wf that accomplishes the same thing using Regex, i am attaching it anyways :smile:
Main.xaml (11.7 KB)