Tab as a delimiter with stringutils

Smee

Well-Known Member
Licensed User
Longtime User
I have this code

B4X:
Dim su As StringUtils
Dim Table,sqlTable As List
Dim Cells() As String 
Dim m As Map
Dim i As Int

SQL.ExecNonQuery("DELETE FROM Products")
Table = su.LoadCSV(File.DirInternal, "some.txt", TAB)
sqlTable.Initialize

For i = 0 To Table.Size - 1
 Cells = Table.Get(i)
 m.Initialize
 m.Put("Code", Cells(0))
 m.Put("Desc", Cells(1))
 m.Put("Loc", Cells(2))
 m.Put("SOH", Cells(5))
 sqlTable.Add(m)
Next

DBUtils.InsertMaps(SQL,"Products", sqlTable)

The problem is some of the fields contain commas thus throwing the cells out. How can i overcome this. The txt file is for all intents unalterable.
 

Smee

Well-Known Member
Licensed User
Longtime User
Solved

It was quotes in the file that was causing the problems. The tab was working fine
 
Upvote 0
Top