Solved

Text Manipulation

Posted on 2003-12-09
3
298 Views
Last Modified: 2010-05-03
I have some email address's ...

xys@sdsd.43fdg.net
wetb256@hotmail.com
(made up for example)

I want to b able to check of the email addess contains "@hotmail.com" or what ever I decide.

if it doesn't contain What I want to check for I want to remove all text before the @ symbol.

So "xys@sdsd.43fdg.net" would become "@sdsd.43fdg.net"
0
Comment
Question by:Terry Rogers
[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 Comments
 
LVL 5

Expert Comment

by:mccainz2
ID: 9907982
Private Sub Command1_Click()
    semail = "xys@sdsd.43fdg.net"
    istart = InStr(1, semail, "@sdsd.43fdg.net")
    If istart > 0 Then
        MsgBox Mid(semail, istart)
    End If
End Sub
0
 
LVL 4

Expert Comment

by:dasari
ID: 9908019
   Dim strEmail As String
   
    strEmail = "xxx@hotmail.com"
    If InStr(1, strEmail, "@hotmail.com", vbTextCompare) <= 0 Then
           strEmail = Mid(strEmail, InStr(1, strEmail, "@", vbTextCompare), Len(strEmail) - InStr(1, strEmail, "@hotmail.com", vbTextCompare))
    End If
    MsgBox strEmail
   
    strEmail = "xxx@yahoo.com"
    If InStr(1, strEmail, "@hotmail.com", vbTextCompare) <= 0 Then
           strEmail = Mid(strEmail, InStr(1, strEmail, "@", vbTextCompare), Len(strEmail) - InStr(1, strEmail, "@hotmail.com", vbTextCompare))
    End If
    MsgBox strEmail
0
 
LVL 3

Accepted Solution

by:
ToolMan earned 35 total points
ID: 9908158
Hi

there are alot of ways to get done what you want........... like here -->

Dim emailAdd(50) As String

emailAdd(0) = "xys@sdsd.43fdg.net"
emailAdd(1) = "wetb256@hotmail.com"
emailAdd(2) = "@ytsascs.com"
emailAdd(3) = ""


For i = 0 To UBound(emailAdd)
    splittedAdd = Split(emailAdd(i), "@")
    If UBound(splittedAdd) > 0 Then
        username = splittedAdd(0)
        domain = "@" & splittedAdd(1)
        Debug.Print "Domain: " & domain
        Debug.Print "username: " & username
    Else
        Debug.Print emailAdd(i) & " is invalid."
    End If
Next
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month7 days, 23 hours left to enroll

617 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