Code: Select all
Col1Array := { 1 : "" }, Col2Array := { 1 : "" }, Col3Array := { 1 : "" }, Col4Array := { 1 : "" }, Col5Array := { 1 : "" }, Col6Array := { 1 : "" }
2DArray := {Col1 : Col1Array, Col2 : Col2Array, Col3 : Col3Array, Col4 : Col4Array, Col5 : Col5Array, Col6 : Col6Array}
Loop, 6
MsgBox % 2DArray[Col%A_Index%].Length()
My use case is this: I'm building a 2D array out of various information read out of a text file, storing information like names, phone numbers, email addresses, etc. The information is all out of order in the text file, so I want to read it into a 2D array such that Col1Array contains all of the names, Col2Array all of the phone numbers, etc, and then use that to write to a CSV file with the information formatted correctly and in order. So when it's parsing through the text file, each time it finds a specific kind of information, it needs to add that information to the end of the array of that type.