Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Print everyhing before and after at

Posted on 2011-09-15
4
Medium Priority
?
291 Views
Last Modified: 2012-05-12
Hi!
If i get an email adress from a database like this <%= rs("email") %> and it contains the adress mc@pz-net.com. How do i do if i want to break up this in two variables one that is called user which contains mc and one called domain that includes pz-net.

With other words i want one variable with everything before at (@) and one from everyhing after.
0
Comment
Question by:MickeC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 36541992
Here is what I use, and it works pretty well.

getName = Left(email,InStr(email,"@")-1)
chDomain = Mid(email,instr(email,"@")+1)

Open in new window


Good Luck
Carrzkiss
0
 
LVL 7

Expert Comment

by:Ironhoofs
ID: 36541993
Use the split() function

var sMail = rs("email")
var aMail = split(sMail, "@")
var sUser = aMail[0]
var sDomain = aMail[1]
0
 
LVL 31

Accepted Solution

by:
Wayne Barron earned 2000 total points
ID: 36542001
Forgot something
For your code, you will need it to be like so.

email = rs("email")
getName = Left(email,InStr(email,"@")-1)
chDomain = Mid(email,instr(email,"@")+1)

Open in new window


Carrzkiss
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 36548052
Glad I could help.
This code is a life saver, big time.

Take Care
Carrzkiss
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question