Get User Name from Email String

S

Scott

I need to get the userName from an Email address. For example, if the email
is (e-mail address removed), how can I can I get just the "username" part using the
RIGHT() or LEFT() functions?
 
M

McKirahan

Scott said:
I need to get the userName from an Email address. For example, if the email
is (e-mail address removed), how can I can I get just the "username" part using the
RIGHT() or LEFT() functions?


Const c = "(e-mail address removed)"

Dim a
a = Split(c,"@")
Response.Write a(0)

or

Dim s
s = Left(c,InStr(c,"@")-1)
Response.Write s
 
E

Evertjan.

McKirahan wrote on 05 feb 2006 in
Const c = "(e-mail address removed)"

Dim a
a = Split(c,"@")
Response.Write a(0)

or in ASP-jscript

var c = "(e-mail address removed)";
response.write( c.split('@')[0] );

or

Dim s
s = Left(c,InStr(c,"@")-1)
Response.Write s

or use a ASP-vbs regex:

c = "(e-mail address removed)"
Set regEx = New RegExp
regEx.Pattern = "@.*"
Response.Write regEx.Replace(c, "")

or a ASP-jscript regex:

var c = "(e-mail address removed)";
response.write( c.replace(/@.*/, '') );

There are many ways to reach Rome:
you can take a scenic route or a fast one,
relying on classic Basic Left() and Right() could be
the OP's preference though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top