PearlJamFanatic
asked on
opencsv CSVReader does not read \ (backslash)
I am reading CSV file using the following code. I use OpenCSV library.
Below you can see the exact csv file line. The first one succeeds it has \ followed by space. The next one fails it has only \. When read the first one returns an array of 12 cells and the next one has only 6.
The below works
"25-Jan-2008 08:46:00","datamirror","", "50545","# PGAAGIN ","1020360224","\ ","0","TRSYS","CMPLACTS ","",""
The below fails
"25-Jan-2008 08:46:00","datamirror","", "50545","# PGAAGIN"," 1020360224 ","\","0", "TRSYS","C MPLACTS"," ",""
I think i need to initilise the CSVReader wih the right constructor. Please help.
csvReaderList.add(new CSVReader(new FileReader(csvFileNames.get(2))));
while ((nextLineCsv1 = csvReaderList.get(0).readNext()) != null&&(nextLineCsv2= csvReaderList.get(1).readNext()) != null&&(nextLineCsv3 = csvReaderList.get(2).readNext()) != null) {
ArrayList<String[]> rowFromAllThreeCsv=new ArrayList<String[]>();
rowFromAllThreeCsv.add(nextLineCsv1);
rowFromAllThreeCsv.add(nextLineCsv2);
rowFromAllThreeCsv.add(nextLineCsv3);
}
Below you can see the exact csv file line. The first one succeeds it has \ followed by space. The next one fails it has only \. When read the first one returns an array of 12 cells and the next one has only 6.
The below works
"25-Jan-2008 08:46:00","datamirror","",
The below fails
"25-Jan-2008 08:46:00","datamirror","",
I think i need to initilise the CSVReader wih the right constructor. Please help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER