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



How do you find out whether the string is Numeric or Alpha numenric.Suppose..'QTP is an autom..

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

How do you find out whether the string is Numeric or Alpha numenric.Suppose..'QTP is an autom..

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

How do you find out whether the string is Numeric or Alpha numenric.Suppose..'QTP is an autom..

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

How do you find out whether the string is Numeric or Alpha numenric.Suppose..'QTP is an autom..

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

Post New Answer

More QTP Interview Questions

How will you set a unique four digit number in an edit field in QTP?

2 Answers   IBM,


How to get all the objects count and objects names in webpage using QTP ?

6 Answers  


How many types of recording facility are available in quicktest professional?

0 Answers  


we add library file used in test via settings or through "ExecuteFile" command. when we implement framework do we make common library file and load the same for all the test cases execution?

0 Answers  


how will we run batch tests in qtp what is the process to run the multiple test sets?

3 Answers  


Give me Example for Generic Functions in QTP Framework....Anybody please answer me..Thanks in Advance

3 Answers   BirlaSoft,


hi all, I have installed QTP successfully on windows vista. I am able to record and run on windows applications, but facing problem with web applications. While recording, I am able to open the web application, but when I click on any object or give login name and password, the events are not getting recorded in QTP. Could anyone solve the problem. Any settings to be done for web applications other than selecting web-addin? Waiting for replies. Thanks in advance.

4 Answers  


In an output value text checkpoint, where does the output value stored by default ?

4 Answers   Ordain Solutions,


How can we open an Excel sheet through the script

8 Answers   eSymbiosis,


I have below user Defained function function AddTwo(ByVal a, ByVal b) Dim Ans Ans=a+b MsgBox Ans End function Now my question comes here...from given below methods which method is right to call above function?Which is Wrong and why? 1. AddTwo(2,4) 2. Call AddTwo(2,4) 3. AddTwo 2,4 4. Call AddTwo 2,4

1 Answers  


What are the Features & Benefits of Quick Test Pro ?

1 Answers   Crea,


Does quicktest professional is unicode compatible?

0 Answers  


Categories