how to remove values from an Array. - 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 remove values from an Array. (/Thread-how-to-remove-values-from-an-Array) |
how to remove values from an Array. - ACCBAJPA - 08-22-2013 guys, I know this question may be straight forward. but I am a beginner and nees to know how to remove specific values from an array. I have a Dynamic Array in_Str_SecurityQ2 like below Code: in_Str_SecurityQ2_List = Browser("br_EMC").Page("pg_ViewProfile").WebElement("ele_SecurityQ2_List").GetROProperty("innertext") this array has UBpund as 16 and contains values as below. What is the first name of your oldest nephew? What is the first name of the best man at your wedding? (Enter full name of street only)? What was the first name of your first boyfriend/girlfriend? What was the first name of your first manager? (Enter full name of town only)? What is the first name of your oldest niece? (Enter full name of city only)What is the name of the first company you worked for? What is your grandfather's nickname? ............ I want to remove the values (Enter full name of street only)? and (Enter full name of town only)? from the Array and also update the size accordingly. Thanks in Advance. RE: how to remove values from an Array. - ssvali - 08-22-2013 You can use REPLACE Built-In Function of Vbscript. Below is the script. A(0) = "What is the first name of your oldest nephew?" B(0) = Replace(A(0),"?","") Msgbox B(0) RE: how to remove values from an Array. - ACCBAJPA - 08-22-2013 I am not sure if what you told will help me as I need to remove "(Enter full name of street only)?" and "(Enter full name of town only)?" these two values from the Array, also the index is not fixed for them. RE: how to remove values from an Array. - ssvali - 08-22-2013 Instead of using array you can give Scripting.Dictionary a try. It is much more flexible, and has, among others Remove method. RE: how to remove values from an Array. - ACCBAJPA - 08-22-2013 thanks I will try it RE: how to remove values from an Array. - ssvali - 08-23-2013 Try this... Code: Qtn = ("a;b;c;d") |