| || |
How to get a value before a particular string
I have a Webelement object "100 text...". The value "100" is dynamic. I want to grab the dynamic value which comes always before the word "text".
Is this posible using QTP?
Re: How to get a value before a particular string
Yes. Probably the more general purpose is to use a Regular Expression object. The simpler (which I suppose is a matter of opinion) is grab the entire string and then use the split() function to get the first portion of the string (the number) before the first <space> char. This second alternative only works if the "<number> <text>" string is separated by a <space> or <tab> char (or a char that is known to always separate the two).
Online help will provide details and example on both approaches.