accept an email id & validate it .email id should not exceed
25 characters the mail id should contain 3 characters
excluding domain name,@ and .(dot) the last 3 characters
of the domain should be net,com or org

Answers were Sorted based on User's Feedback



accept an email id & validate it .email id should not exceed 25 characters the mail id should ..

Answer / mudaseer

vmail=inputbox("enter the value")
vstr=right(vmail,3)
if len(vmail)>25 then
msgbox "length is too high"
elseif instr(vmail,"@")=0 or instr(vmail,".")=0 then
msgbox "invalid-@ or . is absent"
elseif (instr(vmail,"@")-1)<3 then
msgbox "invalid-length to less"
elseif not(vstr="org" or vstr="com" or vstr="net") then
msgbox "invalid-domain not correct"
else msgbox "valid"
end if

Is This Answer Correct ?    2 Yes 1 No

accept an email id & validate it .email id should not exceed 25 characters the mail id should ..

Answer / pankaj jaju

Function IsValidEmail(strEmail)
If Len(strEmail) > 25 Then
IsValidEmail = "Email contains > 25 characters"
ElseIf LCase(Right(strEmail, 4)) <> ".net" AND LCase
(Right(strEmail, 4)) <> ".com" AND LCase(Right(strEmail,
4)) <> ".org" Then
IsValidEmail = "Email contains invalid
domain name. Use only .com or .net or .org domains only"
ElseIf UBound(Split(strEmail,"@")) > 1 Then
IsValidEmail = "@ character is used
multiple time"
ElseIf UBound(Split(strEmail,"@")) < 1 Then
IsValidEmail = "@ character is missing"
Else
IsValidEmail = True
End If
End Function

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More VB Script Interview Questions

how to find the textfile in the folder and copy file from one folder to another folder useing parameterigation in QTP

1 Answers   Accenture,


I have attended Anovatek Software QTP interview. They will give us computer and one web based application with QTP. We have to automate some records (already updated records or new records) using QTP Data driven testing. But we should use for loop? Can any one know how to do data driven testing using For loop?

0 Answers  


please can you help me to get a code of flames using a visual basic 6

0 Answers  


Mention how to create a cookie using vbscript?

0 Answers  


How to capture a runtime error in vbscript?

0 Answers  






Is it possible to pass optional argument to function in vb script?

2 Answers  


what is test scenario?

1 Answers  


a;;b;c;;;d in this string output is abcd will come how can we do that in vbscript in QTP testing?

2 Answers  


How will you convert a string to lower case string using vbscript?

0 Answers  


Mention what is vbscript?

0 Answers  


i have to open a notepad having no. of words in dat file by recording in qtp and then find a particular word and display true or false

0 Answers  


write a vb script to generate the following pattern ***** **** *** ** *

7 Answers   Blue Star,


Categories