Micro Focus QTP (UFT) Forums
How to save the dynamic string into variables? - 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: How to save the dynamic string into variables? (/Thread-How-to-save-the-dynamic-string-into-variables)



How to save the dynamic string into variables? - hamzaz - 04-18-2012

Hi All,

I got a value of dynamic text in the variable, the text is "The value of sum is 88 77 88" now the problem is that its a dynamic text and the numeric values could be more or less. I want to save the numeric values into variable. how can I do it ? any suggestions
my code is

Code:
str=Browser("Logib").Page("EGFR").WebElement("No normal interval ").GetROProperty("text")


This str variable is saving ""The value of sum is 88 77 88""


RE: How to save the dynamic string into variables? - ravi.gajul - 04-18-2012

Assuming that the string "The value of sum is" is not changing and just the number,please use mid function as shown below to extract the number from string
Code:
str="The value of sum is 88 77 88"
num=mid(str,20,len(str))
msgbox  num



RE: How to save the dynamic string into variables? - hamzaz - 04-18-2012

Thank you for your response, I have another question.
Now I got the numbers in the string like
str= 88 77 88
now I am confused a bit, I want to save these numbers in variables
like a=88
b=77
c=88

any suggestions?


RE: How to save the dynamic string into variables? - sshukla12 - 04-18-2012

Hi,

I think there is a seperator in this string and seperator is " ", use split and save the value.

Regards,
Sankalp