0

For example:

a1 = Split("item1 item2 item3")
a2 = Split("value1 value2 value3")

Now I want to create 2-dimensional array named a (2x3 or in vbscript syntax array(1,2))

Is there a way to create this 2-dimensional array without traversing former mentioned arrays element by element?

As a matter of fact I don't even want to create 1-dimensional arrays, but I want to use Split() function and immediately assign each split in adequate 2-dimensional array row, but I can't find any reference how it could be possible. All examples I see are assigning each element separately, like:

Dim a(1,2)
a(0)(0) = "item1"
a(0)(1) = "item2"
...

while I would like something like:

Dim a(1,2)
a(0) = Split("item1 item2 item3")
a(1) = Split("value1 value2 value3")

or anything similar without assigning every element separately.

4

1 回答 1

2

我在这里找到了。这很容易:

a = Array(Split("item1 item2 item3"), Split("value1 value2 value3"))
于 2012-09-14T23:22:30.340 回答