Clean email address display name "Niels <[email protected]>" to extract just [email protected]

hey Niels - you are changing the spec! :grimacing: :slightly_smiling_face:

I agree that Mike’s way is definitely more robust and likely to handle more cases other than the initial three formats presented - but obviously at the price of some complexity.

I like the way Mike first finds the @ then gets the Domain to the right and the User (and perhaps Name) to the left.

I am so used to doing everything in ST these days it does feel a bit strange to see “old school” coding like Mike’s here (and also sometimes some of Carl’s stuff).

one suggestion - look at the lines:

L = LEN(CLIP(LEFT(E)))
LOOP X = A+1 TO L+1

here you could lose characters off the end of the domain if there are leading spaces before the email address…

probably better to

E=LEFT(E)

right at the start before searching for ‘@’

then just

L = LEN(CLIP(E))

and later on where there is

SELF.Name = CLIP(LEFT(E[1:X]))

you would then just say

SELF.Name = CLIP(E[1:X])

hth and cheers for now

Geoff R

1 Like