SparceMatrix
07-01-2006, 03:37 PM
I think I understand that a dynamically set array is done like this:
Dim MyArray()
But, I have not been able to apply this in any prototypical example and I haven't seen any documentation either. Furthermore, I would like to apply a dynamic array with more than one dimension so that I can loop through some variables and create a array of columns, for example, of fixed number. And also, the "split" function is supposed to return a "variant" array and I need to apply this in this same context. Again, no documentation that I can find, and one might hope that one explanation might shed light on another.
This code is from http://cobalt1.cdc.net/caspdoc/html/vbscript_split_function.htm
Dim MyString, MyArray, Msg
MyString = "VBScriptXisXfun!"
MyArray = Split(MyString, "x", -1, 1)
' MyArray(0) contains "VBScript".
' MyArray(1) contains "is".
' MyArray(2) contains "fun!".
Msg = MyArray(0) & " " & MyArray(1)
Msg = Msg & " " & MyArray(2)
MsgBox Msg
What I would like to do is take this array and loop it through any number of times to just repeat the phrase into the array, for example. The array would be something like ...
VBScript is fun!
VBScript is fun!
VBScript is fun!
VBScript is fun!
VBScript is fun!
VBScript is fun!
VBScript is fun!
VBScript is fun!
...
... and the array would be of dimension MyArray(3, 8) in this case or MyArray(8, 3). But in either case the "8" would be replaced by a variable "x" somewhere in the code and I would hope that it looked something like MyArray(x, 3). But again, the array would be dynamic in that first dimension. I can manage already with a variable in array with a fixed dimension length, as in
Dim MyArray(3, 8)
Anybody have any idea what I am talking about? Any and all tips or clues would be appreciated.
Dim MyArray()
But, I have not been able to apply this in any prototypical example and I haven't seen any documentation either. Furthermore, I would like to apply a dynamic array with more than one dimension so that I can loop through some variables and create a array of columns, for example, of fixed number. And also, the "split" function is supposed to return a "variant" array and I need to apply this in this same context. Again, no documentation that I can find, and one might hope that one explanation might shed light on another.
This code is from http://cobalt1.cdc.net/caspdoc/html/vbscript_split_function.htm
Dim MyString, MyArray, Msg
MyString = "VBScriptXisXfun!"
MyArray = Split(MyString, "x", -1, 1)
' MyArray(0) contains "VBScript".
' MyArray(1) contains "is".
' MyArray(2) contains "fun!".
Msg = MyArray(0) & " " & MyArray(1)
Msg = Msg & " " & MyArray(2)
MsgBox Msg
What I would like to do is take this array and loop it through any number of times to just repeat the phrase into the array, for example. The array would be something like ...
VBScript is fun!
VBScript is fun!
VBScript is fun!
VBScript is fun!
VBScript is fun!
VBScript is fun!
VBScript is fun!
VBScript is fun!
...
... and the array would be of dimension MyArray(3, 8) in this case or MyArray(8, 3). But in either case the "8" would be replaced by a variable "x" somewhere in the code and I would hope that it looked something like MyArray(x, 3). But again, the array would be dynamic in that first dimension. I can manage already with a variable in array with a fixed dimension length, as in
Dim MyArray(3, 8)
Anybody have any idea what I am talking about? Any and all tips or clues would be appreciated.