![]() |
How to convert three arrays into just ONE 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 convert three arrays into just ONE array? (/Thread-How-to-convert-three-arrays-into-just-ONE-array) |
How to convert three arrays into just ONE array? - Arena - 04-10-2012 Hi, I have a question regarding array of arrays. I have three arrays that were created by spliting a string: sText0 = "0;3;6;9" sText1 = "1;4;7;10" sText2 = "2;5;8;11" arr0=Split(sText0,";") arr1=Split(sText1,";") arr2=Split(sText2,";") What can I do to make these three arrays to become ONE array? I am trying this but with no success: Dim arrTest arrTest(0)=arr0 arrTest(1)=arr1 arrTest(2)=arr2 Can you help me, please? Thanks, Arena RE: How to convert three arrays into just ONE array? - vIns - 04-10-2012 Do u want to create 1 dimensional array by joining them? or 2 two dimensional array? If it is one dimensional... Code: Function combineArray(arr1,arr2) as you had split the string..i am joining back all the array elements as a single string and do a final split to create an array... But it might not be a good approach...because if the array element itself has the delimiter as content (%^&)..then the result might not be as expected.. so create a function and create an array in it with a size by adding 2 array sizes. then use for loop to iterate thro passed array elements and to store it in the new array. RE: How to convert three arrays into just ONE array? - Arena - 04-10-2012 Hi vIns, I want the new array to be a 2D array. Will the above code work? Also, what does (%^&) mean? Thanks, Arena |