Closed GoogleCodeExporter closed 8 years ago
Hi, I'm looking into creating a new CSVReader... Do you have any indication of
the data that makes the CSVReader fail? That would make a great unit-test :-)
Thanks, Jesper
Original comment by jesperudby
on 31 Jan 2013 at 8:28
Hi Jesper, I changed it a bit (see below) it is working for me now:
public void writeToCSVFile(CSVReader rdr, String fileName) throws IOException
{
List<String> resultHeader = rdr.nextRecord();
String[] resultHeaderForCSV = new String[resultHeader.size()];
for (int k = 0; k < resultHeader.size(); k++)
{
resultHeaderForCSV[k] = resultHeader.get(k);
}
List<String> row;
Writer writer = new FileWriter(fileName);
CsvWriter csvWriter = new CsvWriter(resultHeaderForCSV, writer);
while ((row = rdr.nextRecord()) != null)
{
String[] resultRecord = new String[resultHeader.size()];
for (int i = 0; i < resultHeader.size(); i++) {
//resultInfo.put(resultHeader.get(i), row.get(i));
resultRecord[i] = row.get(i);
}
csvWriter.writeRecord(resultRecord);
}
csvWriter.endDocument();
}
Original comment by thysmich...@gmail.com
on 31 Jan 2013 at 10:08
Good :-) I've made a couple of unit-test with the current CSVReader and does
not actually see any big issues with it. I will leave it for now.
Should we close this issue then?
Thanks
Jesper Udby
Original comment by jesperudby
on 1 Feb 2013 at 8:31
Closing
Original comment by jesperudby
on 4 Feb 2013 at 2:52
Hello everyone who faced with such problem.
Take a look on the example below, it could be helpful if you want to use
quotes(") in your data:
If you wanna put "example" to your csv file use """example"""
First quotes mean that your are going to use quotes in your data
Second quotes are like the symbols that are used for escaping the real quotes
Third quotes are real quotes
Thanks,
Anton
Original comment by samsonov...@gmail.com
on 21 Nov 2014 at 11:50
Original issue reported on code.google.com by
thysmich...@gmail.com
on 7 Jan 2013 at 4:04