
me parecio interesante el planteamiento del problema, yo lo solucione con esta funcion que regresa un arreglo el cual contiene un arreglo con los subelementos en sus indices, al final solo iteras el arreglo y por cada indice preguntas si es arreglo y lo iteras.
Código:
<%
Function generaArregloPadre(arreglo, strCaracter)
Dim indices
Dim i
Dim j
Dim x
Dim tempArr()
indices = 0
if isArray(arreglo) then
redim preserve arreglo(uBound(arreglo) + 1)
arreglo(uBound(arreglo)) = strCaracter
for j = 0 to uBound(arreglo)
if arreglo(j) = strCaracter then
indices = indices + 1
end if
next
'Response.Write "Numero de indices arreglo padre : " & indices & "<br>"
Dim ds()
redim ds(indices)
i = 0
x = 0
for j = 0 to uBound(arreglo)
if arreglo(j) <> strCaracter then
'Response.Write("Redimensionamos arreglo temporal: tempArr("&x&")" & "<br>")
redim preserve tempArr(x)
'Response.Write("Asignamos valor: tempArr("&x&") = " & "arreglo("&j&")" & "<br><hr>")
tempArr(x) = arreglo(j)
x = x + 1
else
x = 0
'Response.Write("<b>Asignamos arreglo a indice del arreglo padre: ds("&i&") = " & typename(tempArr) & "</b><br>")
ds(i) = tempArr
'Response.Write("redimensionamos arreglo temporal: temparr("&x&")")
redim tempArr(x)
i = i + 1
end if
next
else
ds = null
end if
generaArregloPadre = ds
End Function
Felices trazos!
Editando: fijate en destruir los arreglos cuando ya no los utilices dentro de la funcion, es solo una primera aproximacion, pues creo que se puede sintentizar haciendo el desarrollo de la funcion dentro del primer for...