read random entry from csv

Fox

Active Member
Licensed User
Longtime User
is it possible that i can read an random entry from an csv file... and write this result in an label...

is here one that have an example for me how can i realize that?!

Help would be nice.
 

enonod

Well-Known Member
Licensed User
Longtime User
This is what I used...
B4X:
Dim sTest() as String
...

Sub CSV
    Dim su As StringUtils
    Dim csv As List
    csv = su.LoadCSV(File.DirAssets, "tests.txt", ",")
    sTest = csv.Get(0)
End Sub
Tick the String utils Library in the IDE Libs tab
Put the file in the Files folder under your project.
Then in the main code, for example, access sTest(7)
 
Last edited:
Upvote 0
Top