Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to convert three arrays into just ONE array?
#1
Not Solved
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
Reply
#2
Not Solved
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)
            combineArray = Split(Join(arr1,"%^&") & "%^&" & Join(arr2,"%^&"),"%^&")
End Function

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.
Reply
#3
Not Solved
Hi vIns,

I want the new array to be a 2D array.
Will the above code work?
Also, what does (%^&) mean?

Thanks,

Arena
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [UFT] Get Item of ListBox and convert it to array felino 1 2,476 11-26-2015, 02:20 PM
Last Post: felino
  How to convert a single dimension array to two dimensional array venkatesh9032 3 5,630 02-10-2014, 03:07 PM
Last Post: pranikgarg
  How to convert integer to decimal automation2012 2 5,535 03-25-2013, 04:44 PM
Last Post: automation2012
  Adding array to another Global array in VB Script test911 1 3,205 12-02-2012, 12:40 PM
Last Post: parminderdhiman84
  Editing java arrays in QTP davey2582 2 4,416 12-21-2011, 07:24 PM
Last Post: davey2582

Forum Jump:


Users browsing this thread: 1 Guest(s)