Micro Focus QTP (UFT) Forums
Issues with comparison - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Issues with comparison (/Thread-Issues-with-comparison)



Issues with comparison - indranilgoswamimcb - 09-21-2010

I have 2 variables whose values are as follows:

Var1 = 65,000
Var2 = 65000

The value of the first variable is obtained through 'Split' function of a innertext property of an object while the second variable is the value obtained from the text displayed in a text box.

My objective is to compare these 2 variables and the result should be that both are same.

for example:
strcomp(var1,var2) result should be 0.

Please let me know how do I accomplish this.


RE: Issues with comparison - Saket - 09-21-2010

remove ',' from the first variable and then compare. you can use Replace function


RE: Issues with comparison - indranilgoswamimcb - 09-21-2010

I just gave the " " as an example but the script that I am using displays 65,000 if I do a msgbox on the variable.
So, my query comes down to simply removing the , from the 65,000. How do I do it?


RE: Issues with comparison - guin.anirban - 09-21-2010

Var1 = "65,000"
MsgBox Replace(Var1, ",", "")