Micro Focus QTP (UFT) Forums

Full Version: How to save the dynamic string into variables?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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""
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
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?
Hi,

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

Regards,
Sankalp