Android Question Loading 2D array

JamesGreaves

Active Member
Licensed User
If I have a string of Data:
B4X:
Dim RowOfData As String = "1,2,3,4,5,"
And a 2D Array
B4X:
Dim DataGrid(5,5) As String
Is there a way I can load RowOfData into the first row of the Array, with ONE function.
SO that :
B4X:
DataGrid(0,0) = "1"
DataGrid(0,1) = "2"
DataGrid(0,2) = "3"
DataGrid(0,3) = "4"
DataGrid(0,4) = "5"
I was hoping For something like this:
B4X:
DataGrid (0) = Regex.Split(",", RowOfData)
 

RB Smissaert

Well-Known Member
Licensed User
Didn't you already have a list, holding 1d arrays after code suggested by Klaus?

B4X:
lstRows = StringUtils.LoadCSV(DirName, FileName, TAB)
In that case:
Do you really need to the 2D array?
If so: you can just iterate the 1D arrays of the list and copy the values to the 2D array.

RBS
 
Top