I try to split a string into a multidimensional array, but it is not working the way I want. I just split a string to some arrays where one 2 dimensional array should represent a table. I can see the array using _ArrayDisplay()
but I cannot work with the array elements itself. The Line:
For $j = 1 To $aTable1Row[$i][0]
reports "incorrect number of subscripts". But if I do:
MsgBox(1, "TEST", UBound($aTable1Row[$i]))
it shows this array has 8 elements. So they are there but I somehow cannot access them. Full source code:
#include <Array.au3>
$string = "az#1:y#2:x#3:w#4:v#5:u#6:t#7-bz#1:y#2:x#3:w#4:v#5:u#6:t#7-cz#1:y#2:x#3:w#4:v#5:u#6:t#7"
$aTable1 = StringSplit($string, '-',1)
_ArrayDisplay($aTable1)
;3
;az#1:y#2:x#3:w#4:v#5:u#6:t#7
;bz#1:y#2:x#3:w#4:v#5:u#6:t#7
;cz#1:y#2:x#3:w#4:v#5:u#6:t#7
Local $aTable1Row[$aTable1[0]+1]
$aTable1Row[0] = $aTable1[0]
For $i = 1 To $aTable1Row[0]
$aTable1Row[$i] = StringSplit($aTable1[$i], ':',1)
_ArrayDisplay($aTable1Row[$i])
;7
;az#1
;y#2
;x#3
;w#4
;v#5
;u#6
;t#7
;do stuff
For $j = 1 To $aTable1Row[$i][0]
$aTable1Row[$i][$j] = StringTrimLeft(($aTable1Row[$i])[$j], StringInStr(($aTable1Row[$i])[$j], '#'))
Next
Next