devxlogo

Parsing String for E-Mail Address

Parsing String for E-Mail Address

Question:
I semi-understand InStr, however, lets say I am trying to parse e-mail addresses and test for “@”. How do I find my way to the beginning and end of the address?

Answer:
Let’s say that sEmail is the address of someone (for example, sEmail = “[email protected]”)

sUserID = left$(sEMail, Instr(sEMail, “@”) – 1)sHostname = right$(sEMail, len(sEMail) – Instr(sEMail, “@”))
Instr(sEMail, “@”) returns the integer 8.

devx-admin

Share the Post: