Hi,
I am using OutputCheckPoint for 2 webelements Bed:4 and
Bath:2 Full,1 partial in my result page and I am storing
the value in the data table.

I dont need the string Bed:4,I would like to get only the
no 4.
How can I get it?
Even though I highlight only 4,It is seleting the full
value "bed 4".

Same thing happend for second webelement Bath:2 Full,1
partial
I need only the No 2.

I used the following to split
MyArray = Split(UIBathResult, " ", -1, 1)
But it is giving the value
My Array(0)=Bath:2full,1Partial

I need the only the nos for further comparision.Any help?

Thanks
Uma

Answers were Sorted based on User's Feedback



Hi, I am using OutputCheckPoint for 2 webelements Bed:4 and Bath:2 Full,1 partial in my result pa..

Answer / nath. t

Function returnNumber(str)
For i = 1 To Len(str)
num = Mid(str, i, 1)
If IsNumeric(num) Then
returnNumber = num
Exit Function
End If
Next
End Function

str1 = "Bed:4"
str2 = "Bath:2full, 1Partial"
str3 = "1Partial"
x = returnNumber(str2) 'You can send any string it will
find and return the first number in the String.
MsgBox x

Is This Answer Correct ?    0 Yes 0 No

Hi, I am using OutputCheckPoint for 2 webelements Bed:4 and Bath:2 Full,1 partial in my result pa..

Answer / Parul Chaudhary

To get only the numbers (4 and 2) from the specified webelements, you can use Regular Expressions (RegEx) in QTP. Here's an example code snippet for getting the number 4:nnDim RegExpObj As New RegExpnRegExpObj.Pattern = d+nRegExpObj.IgnoreCase = TruenRegExpObj.Global = FalsenUIBedResult.SubString (RegExpObj.Execute(UIBedResult).Item(0).Text, 1, RegExpObj.LastIndex)nnSimilarly, you can modify the code to get the number 2 from the Bath webelement.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More QTP Interview Questions

Hi All, I need code for how to execute qtp scripts from excell sheet

1 Answers  


Hi Friends, I have an application that is having some options to choose. While doing business transaction I need to select one option among from available options. But here the thing is, we won't get one option which we've chosen already and the available options will get automatically from the system with time basis, moreover each and every option having with various label names respective to that option. So obviously if I run my recorded script will automatically gets fail, even though it got pass at first time. Could anyone please give me appropriate solution for this. I would be greatly obliged with you if you give the solution as soon as possible.

1 Answers   Zensar,


Is QTP Supports SWT applications? If yes, can you write a sample script for opening a new package in eclipse.

1 Answers   IBM,


how do you find the number of occurences of string QTP from the expression , " QTP+QTP=2QTP"

5 Answers   IBM,


I want to check in the data table(Globalsheet) column exist or not through script .If column not exist only proceeded to next step Pls tell me how to proceeded?

5 Answers   Syntel,


Waht is User interface and Integration Testing?

1 Answers  


what is the difference between IE & Netscape in web testing on a log in page

1 Answers   TCS,


Can you write User defined function for WebEdit ? Note1: This function can be used for all web edits in all pages Note2: Don't use Child objects method

1 Answers   IBM,


What is Description Object?

1 Answers  


in order to start automation testing what we should require (entry level to automation testing)

2 Answers  


What are Add-ins availble in licensed version QTP8.2

1 Answers   TCS,


To which environments does quicktest professional (qtp) supports?

1 Answers  


Categories