Jump to content

[Resolvido] Como remover caracteres antes do @ no email


leo2012
 Share

Recommended Posts

Boas,

Estou com uma dúvida de como remover todos os caracteres anteriores ao arroba (@) antes de um e-mail, fazendo ficar só o que tem depois. Ex:

entrada: teste@gmail.com

saída: gmail.com

Link to comment
Share on other sites

1º - Descobre a posição/index do caracter '@' (em vba podes usar InStr, em vb.net nao sei)

2º - faz um substring dessa posição até ao final (em vba podes usar Mid, em vb-net nao sei)

Link to comment
Share on other sites

a_tua_string.Substring(a_tua_string.IndexOf("@")+1)

Também podes optar por um split, se forem sempre emails:

a_tua_string.Split("@")(1)
  • Vote 1

Sérgio Ribeiro


"Great coders aren't born. They're compiled and released"
"Expert coders do not need a keyboard. They just throw magnets at the RAM chips"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.