developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks




Need Check Email ID with out special Char
amar ku das 09/16/2016 05:26 AM
Domino Server 7.0.3 Windows Vista


Hi All,

I have a code which validate Email id not have special character or ascii charter and it is running fine but it take some time to serach so can you help me is there any process who execute this fast with all check

My Code-> in email it carry email id
Function allemailcheck(email As String) As Integer
Dim count As Integer
Dim count1 As Integer
Dim strSpecial As String
Dim intCountSpecial As Integer

strSpecial = "<>=?*+/\!#${}[]()^~%|;:,`" & Chr(32) + Chr(34) + Chr(13) + Chr(10)

count=0
count1=0

If Not email Like "[!@,*,&]*@*.[! @]*[! @,.,&,!]" Then
allemailcheck=0
Msgbox("Special characters found in the Email Address. Please enter a valid Email Address.")
Exit Function
End If

For i=1 To Len(email)
oneChar$=Mid(email, i,1)

If Mid(Trim(email), i, 2) = "@." Or Mid(Trim(email), i, 2) = ".." Or Mid(Trim(email), i, 2) = ".@" Then
allemailcheck=0
Msgbox("Special characters found in the Email Address. Please enter a valid Email Address.")
Exit Function
End If

If onechar$="@" Then
count=count+1
If count>1 Then
allemailcheck=0
Msgbox("Special characters found in the Email Address. Please enter a valid Email Address.")
Exit Function
End If
End If


For intCountSpecial = 1 To Len(Trim(strSpecial))

If Asc(onechar$) < 33 Then
allemailcheck=0
Msgbox("Special characters found in the Email Address. Please enter a valid Email Address.")
Exit Function
End If


If onechar$ = Mid(Trim(strSpecial), intCountSpecial, 1) Then
allemailcheck=0
Msgbox("Special characters found in the Email Address. Please enter a valid Email Address.")
Exit Function
End If
Next


allemailcheck=1

Next

End Function

Go back