Capture data between [BRACKETS] - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming) +--- Thread: Capture data between [BRACKETS] (/Thread-Capture-data-between-BRACKETS) |
Capture data between [BRACKETS] - nayak - 02-18-2012 Dear QTP/VBscript experts: Here is what I am not able to do. Please help me. 1. capture specific data located in a WebElement data string 2. the WebElement has data like this ---> I am in [London] for 1 week I need to capture London from the data string in the WebElement. Basically I want to capture data between the brackets [] 3. Hold this in a variable and compare input parameter with output data which is the data between the brackets. 4. I need to use an IF THEN ELSE IF statement to compare the two variables and show what was captured in the result. I tried to capture from WebTable but the brackets are a part of the data like [London] so I still cannot compare. Expected data is London but actual is showing as [London] I am not sure how to isolate this data from the rest of the data. Please help. Thanks. RE: Capture data between [BRACKETS] - inborntester - 02-18-2012 i am bit not clear with what data u get either whole "I am in [London] for 1 week" or "[London]" anyway try below to remove brackets and get data. and do if for compare, bit easy only. Case1: Code: data ="I am in [London] for 1 week" Case2: Code: data="[London]" RE: Capture data between [BRACKETS] - Ankur - 02-18-2012 @inborntester - Thanks for your contribution here. Could you please make sure to keep your code snippets under code tags? You can use 'Preview post' button and then select code tag from the tool bar. I am doing it for you this time. RE: Capture data between [BRACKETS] - kotaramamohana - 02-19-2012 Here is one more logic Code: data ="I am in [London] for 1 week" RE: Capture data between [BRACKETS] - nayak - 02-21-2012 @inborntester - I tried Case1 Code. Its working as I wanted. Thank you very much! |