I've been struggling with generating a 2D array from a string. Perhaps
someone can shed some light on the process or point me in the right
direction...
The string in question looks something like this:
1[/field]Penguins[/field][/record]2[/field]Skuas[/field][/record]5[/field]Eagles,
Golden[/field][/record]
I know this is a rather odd string, but suffice it to say its generated
to represent a series of records which cannot be retrieved via typical
ASP/ADO recordset fashion. The environment is classic ASP using
VBScript.
I can readily break this up into a 1D array using
split(str,"[/record]").
But this yields only the 3 combined sets:
1[/field]Penguins[/field]
2[/field]Skuas[/field]
5[/field]Eagles, Golden[/field]
What I'm looking for is a way to make this a 2D array such that:
aryBirds(0,0) = 1
aryBirds(0,1) = Penguins
aryBirds(1,0) = 2
aryBirds(1,1) = Skuas
aryBirds(2,0) = 5
aryBirds(2,1) = Eagles, Golden
Unfortunately my searching thusfar hasn't hit on what looping is
required to get this 2D result.
So far I've tried things like
For i = 0 to Ubound(aryCombinedSets)-1
aryNewSets = split(aryCombinedSets(i),"[/field]")
For j=0 to Ubound(aryNewSets)-1
aryBirds(i,j) = (aryNewSets(j), j)
Next
Next
But these only generate the last 2 values of the array. That is only
the 5 and Eagles, Golden values are retrievable.
I have several similar strings. In each case I know how many fields
exist, but the number of records varies. In each case I need to make a
2D array so that values can be individually manipulated.
Any assistance or pointers in the right direction would be helpful.
Thanks!
Bonnie