Roger
This function only looks for linefeeds as line breaks.
If the lines end with carriage return + linefeeds, the carriage return ends up on the end of the last field read.
Are lines in CSV files supposed to only use LF as a line break and not CRLF?
dc_csv2array()
dc_csv2array()
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com
Real Business Applications Ltd
http://www.rbauk.com
Re: dc_csv2array()
I think I found out that some CSV files don't have CR characters.
Give this a try to see if it solves your problem.
Give this a try to see if it solves your problem.
Code: Select all
cCsvFile := Strtran(cCsvFile,Chr(13),'')
aCsv := DC_Csv2Array(cCsvFile)
The eXpress train is coming - and it has more cars.
Re: dc_csv2array()
Hmm... The CR is not in the filename... :-)rdonnay wrote:I think I found out that some CSV files don't have CR characters.
Give this a try to see if it solves your problem.Code: Select all
cCsvFile := Strtran(cCsvFile,Chr(13),'') aCsv := DC_Csv2Array(cCsvFile)
I took a copy of the function code and added a line that does that. So my code is OK.
But I thought maybe you could add something like this after the dc_txtline is called:
Code: Select all
if right(cLine,1) == chr(13)
cLine:=left(cLine,len(cLine)-1)
endif
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com
Real Business Applications Ltd
http://www.rbauk.com