JamesGreaves Active Member Licensed User Sep 13, 2019 #1 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)
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)
DonManfred Expert Licensed User Longtime User Sep 13, 2019 #2 https://www.b4x.com/android/forum/threads/create2darray.39315/#content ? Upvote 0
R RB Smissaert Well-Known Member Licensed User Longtime User Sep 13, 2019 #3 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 Upvote 0
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
JamesGreaves Active Member Licensed User Sep 13, 2019 #4 Thanks for the help. I think I am getting the hang of it now. Upvote 0