?
Solved

Text-Manipulation

Posted on 2003-03-20
5
Medium Priority
?
151 Views
Last Modified: 2010-05-01
if a var_string = "aaa,bbb,ccc" , how to separate it and makes it to
var_part1 ="aaa"
var_part2 ="bbb"
var_part3 ="ccc" ?


how to do a good and solid email validation but not just only detect the "@" ?

thanks !

Marks will be awarded . First come first serve :)
0
Comment
Question by:ANGWK
[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
  • 2
5 Comments
 
LVL 11

Expert Comment

by:supunr
ID: 8179099
var_part1 =split(var_string , ",")(0)
var_part2 =split(var_string , ",")(1)
var_part3 =split(var_string , ",")(2)

Good Luck!
0
 
LVL 11

Accepted Solution

by:
supunr earned 60 total points
ID: 8179113
Email check.....

AtSymLocation = InStr(1, txtEmail, "@")
if (AtSymLocation = 0) then
   msgbox "Invalid Email!"
   exit sub
end if
If (InStr(AtSymLocation, StxtEmail, ".") then
   msgbox "Invalid Email!"
   exit sub
End if
' and there are other checks you could do such as checking if the last 2 characters are alphebatical, etc.
0
 
LVL 11

Expert Comment

by:supunr
ID: 8179125
If (InStr(AtSymLocation+1, txtEmail, ".") = 0) then
  msgbox "Invalid Email!"
  exit sub
End if
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 8179667
Use the Split () function. It takes a string as the first argument and splits it into as many substrings as specified by the third argument, the splitting being done on the basis of the second argument, and it returns an array of strings (the substrings). Like:

Dim myArray () as String

' Let's say that there are 'n - 1' commas

ReDim myArray (n)
myArray = Split (var_string, ",", n)

If var_string contains "aaa,bbb,ccc":

myArray(0) has "aaa"
myArray(1) has "bbb"
myArray(2) has "ccc"

Hope that helps!

Mayank.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 8179694
As for determining if an e-mail ID is possibly valid or not:

1. It must contain only one '@' and at least one '.' (dot or period) after the '@' (some office IDs also allow a dot in the username, but there must be one dot somewhere after the '@') .

2. It must not contain any characters other than '@', '.', '_' (underscore), '-' (hyphen is allowed in some office IDs), numbers and alphabets.

3. There must be at least one character between every '@' and '.' or between every '.' and another '.'

4. The '@' and '.' must not be the first or last characters.

That much will tell you if an e-mail ID is possibly valid or not. Then, all that is left is to actually verify it by sending a mail.

Hope that helps!

Mayank.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses
Course of the Month8 days, 8 hours left to enroll

764 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