?
Solved

Text-Manipulation

Posted on 2003-03-20
5
Medium Priority
?
152 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
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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, 10 hours left to enroll

621 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