B4J Question StringUtils: SaveCSV2 Quotes & extra LF?

KMatle

Expert
Licensed User
Longtime User
I've mentioned that SaveCSV2 produces quotes and extra LF's. Any reason for that behaviour?

This code

B4X:
Dim ExportList As List
        ExportList.Initialize
        Dim ExportMap As Map
        For i=0 To OrderList.Size -1
            Dim row(9) As String
            ExportMap=OrderList.Get(i)
            Log(ExportMap)
            For l=0 To ExportMap.Size-1
                Log(ExportMap.Get(l))
                row(l)=ExportMap.Get(l)   
            Next
            ExportList.Add(row)           
        Next
   
        Dim EFn As String = "Export" & DateTime.Now & ".csv"
       
        Dim CSVHeaders As List
        CSVHeaders.Initialize2(Array As String("Status", "SMS-time","SMS-ID" ,"Customer-Name", "Customer-Phone", "Rec.-Name", "Rec.-Phone","Amount","Remarks"))
        su.SaveCSV2(File.DirApp,EFn,";",ExportList,CSVHeaders)

with this data
B4X:
(MyMap) {0=Paid, 1=1480922167539, 2=8, 3=Michael, 4=0123456789, 5=Klaus, 6=015757637287, 7=50, 8=iwsjajjskykskskwkskxixkdkkekwwjjsjdkxkckcidkdkekwkwkskskxkxkksksksksk
}
Paid
1480922167539
8
Michael
0123456789
Klaus
015757637287
50
iwsjajjskykskskwkskxixkdkkekwwjjsjdkxkckcidkdkekwkwkskskxkxkksksksksk
(MyMap) {0=Completed, 1=1481534084873, 2=21, 3=Michael, 4=0123456789, 5=Klaus, 6=35646464949, 7=20, 8=Twice test
}
Completed
1481534084873
21
Michael
0123456789
Klaus
35646464949
20
Twice test

produces this csv file:

Unbenannt.JPG


As you can see the last string is embedded in quotes (why not the others?). The closing quote is in the next line which causes Ecel not to show the last String "Twice test".

Any ideas? I checked everything. As you can see, I do not add quotes. So where are they from?
 
Top