473,320 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Get User Name from Email String

I need to get the userName from an Email address. For example, if the email
is us******@cnn.com, how can I can I get just the "username" part using the
RIGHT() or LEFT() functions?
Feb 5 '06 #1
2 1441
"Scott" <sb*****@mileslumber.com> wrote in message
news:OA**************@TK2MSFTNGP14.phx.gbl...
I need to get the userName from an Email address. For example, if the email is us******@cnn.com, how can I can I get just the "username" part using the RIGHT() or LEFT() functions?

Const c = "us******@cnn.com"

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

or

Dim s
s = Left(c,InStr(c,"@")-1)
Response.Write s
Feb 5 '06 #2
McKirahan wrote on 05 feb 2006 in
"Scott" <sb*****@mileslumber.com> wrote in message
I need to get the userName from an Email address. For example, if the
email is us******@cnn.com, how can I can I get just the "username"
part using the
RIGHT() or LEFT() functions?
Const c = "us******@cnn.com"

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


or in ASP-jscript

var c = "us******@cnn.com";
response.write( c.split('@')[0] );

or

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


or use a ASP-vbs regex:

c = "us******@cnn.com"
Set regEx = New RegExp
regEx.Pattern = "@.*"
Response.Write regEx.Replace(c, "")

or a ASP-jscript regex:

var c = "us******@cnn.com";
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.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Feb 5 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Todd Beaulieu | last post by:
Hello, I'm using the configuration block to store user settings in the app.config file. As this exe will reside on a network drive, I can't have users trying to update the master app.config...
3
by: Lekyan | last post by:
I have problem setting the password for an ADAM user using C#. I used the SetPassword code given in the Microsoft page, changed several parameters, but ran into an exception. I wonder if other...
15
by: Tom Nowak | last post by:
I am writing a webapp in which a user is required to enter a login id and password on a login form. I have forms authenticaion coded in my web.config. Once the user is logged in, I want to use the...
14
by: Vincent Finn | last post by:
Hi, I am writting a web service and I need to get the User's name I can get the username from User.Identity.Name but I want the display name So instead of "mydomain\jsmith" I want to get...
4
by: Dave | last post by:
If I have a string field that contains the name of a User Control, how could I access the User Control? I need something like the following function: dim ucUC as UserControl Dim strUC as string...
8
by: fernandezr | last post by:
I would like to use a user control as a template inside a repeater. Some of the fields in the control should be hidden depending on whether or not there is data. I'm still a ASP .Net newbie so the...
9
by: abprules | last post by:
Can somehow tell me the best way for multi user development to occur in MS Access? The situation is: We are creating a new database for a small company. There are 2 of us who want to...
2
daJunkCollector
by: daJunkCollector | last post by:
Hey, I am having a user fill out a form then the fields are going to uploaded to my database. So, at this point, when the user hits the submit button I want three things to happen: 1. The form...
0
by: rbukkara | last post by:
Hi, I have got the following error while trying to add a user in the LDAP Directory. javax.naming.NameNotFoundException: ; remaining name 'uid=vassila,ou=People,dc=cs,dc=uno,dc=edu' I have...
4
by: suganya | last post by:
Hi By getting the email id from txtEmailId, I have to send the user name & password to that particular email id. For that on button click event I have given the coding as Protected Sub...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.