Android Question Question Stringutils loadcsv

fatman

Active Member
Licensed User
Longtime User
Hi to all,

i´m trying to import a csv-file like that: mylist = su.loadcsv(file.dirrootexternal...
which is no problem.
The csv-file contains several colums like: "column1","column2","column3", etc
Every line in mylist contains an array.
Stupid question: how to get access to each element in every array?

Every hint is welcome.

Fatman
 

DonManfred

Expert
Licensed User
Longtime User
show us your code to load the csv.
It will be easier to answer your question.

B4X:
For Each Row() As String In su.LoadCSV (File.dirrootexternal,"my.CSV",",")
' You can access the LINE with
' dim s as string = Row(0) ' 1. line
'dim values() as string = Row(0) ' get the columns from one line...
' use values to the access the columns... 0 to x (values(0) 1st column, value(1) the second....)
For Each n As String in Row
   Log(n)
Next
Next
 
Upvote 0

Gary Miyakawa

Active Member
Licensed User
Longtime User
show us your code to load the csv.
It will be easier to answer your question.

B4X:
For Each Row() As String In su.LoadCSV (File.dirrootexternal,"my.CSV",",")
' You can access the LINE with
' dim s as string = Row(0) ' 1. line
'dim values() as string = Row(0) ' get the columns from one line...
' use values to the access the columns... 0 to x (values(0) 1st column, value(1) the second....)
For Each n As String in Row
   Log(n)
Next
Next

Don,

Thank you for this but for the life of me, I can't get the column information without using regex.split. I KNOW I'm doing something wrong... Your example code got me close but still struggling with the columns. Could you complete the example in working code ?

Sorry for my stupidity today... :( :(

Gary Miyakawa
 
Upvote 0
Top