How do you find out whether the string is Numeric or Alpha
numenric.Suppose..'QTP is an automation testing tool 12345'
How should I know it is alphanumeric.Can any one please
write the code for this
Answers were Sorted based on User's Feedback
Answer / ashish sharma
str = "QTP is an automation testing tool "
Dim ianRegEx
Set ianRegEx = New RegExp
ianRegEx.Pattern = "[a-z]+[\s]*[0-9]+"
ianRegEx.Global = True
ianRegEx.IgnoreCase = True
msgbox ianRegEx.Test(str)
Is This Answer Correct ? | 4 Yes | 0 No |
Answer / a.thirumalareddy@gmail.com
use this function it will help u..
Function IsAlphaNumeric()
If IsNull(str) Then str = "QTP is an automation testing tool 12345"
Dim ianRegEx
Set ianRegEx = New RegExp
ianRegEx.Pattern = "[^a-z0-9]"
ianRegEx.Global = True
ianRegEx.IgnoreCase = True
IsAlphaNumeric = (str = ianRegEx.Replace(str,"QTP is an automation testing tool 12345"))
msgbox IsAlphaNumeric
End Function
call IsAlphaNumeric()
Is This Answer Correct ? | 4 Yes | 2 No |
Answer / xyz
Hi Tirumalareddy thanks for giving the reply.I have
executed the script.It is working fine for the above
srting.but if I removed 12345 from the string,still it is
displaying TRUE.I think it is not correct.anyhow thanks for
reply
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / mrclock
A.thirumalareddy was on the right track, but here is a
revised and working version of his code:
Function IsAlphaNumeric()
Dim strText: strText = "QTP is an automation testing tool
12345" 'Search String
Dim ianRegEx
Set ianRegEx = New RegExp
ianRegEx.Pattern = "[^a-z0-9]" 'Define Search Pattern
ianRegEx.Global = True 'Apply Globally
ianRegEx.IgnoreCase = True 'Ignore upper/lower case
IsAlphaNumeric = ianRegEx.Test(strText) 'Use Test method
for a True/False test
msgbox IsAlphaNumeric 'Display True/False
End Function
call IsAlphaNumeric()
Is This Answer Correct ? | 1 Yes | 1 No |
Have you worked with QC?
How to Test Dynamic links ?
write a script for get the following result: username password frm the string1="A=username" string2="B=password"
How to use descriptive programming?
Give the syntax to import/export xls into qtp.
Hi, Is there any function or vbscript in QTP to clear the cookies,sessions. Please help me in this.
How many regression test suits in your appliction?
hi,i have a pblm in qtp,im testing an webappl in which different types of error pop up messages are displayed which qtp is not differentiating or it is not recognising. how do i make it recognise different popup errorm messages while writing script?
What are the properties you would use for identifying a browser & page when using descriptive programming ?
what are the metrics in general we use in testing.
How do I lauch my test website using code from qtp in different environmet, uat and PPTE?
Which MS Excel formulas are possible to use in the DataTable? I am searching a formula for searching a field in the datatable