问题
In my csv file i have some paths,, and open Csv is reading path without"\",, for example: C:\abc\ab.txt
is readed as C:abcab.txt
. I want to read the as it is without any change ??
回答1:
For OpenCSV, '\' is default escape character. You can change default escape character:
CSVReader reader = new CSVReader(
new FileReader("E:\\download\\sample.csv"),
CSVParser.DEFAULT_SEPARATOR,
CSVParser.DEFAULT_QUOTE_CHARACTER,
'#');
By the way, you can try jCSV.
来源:https://stackoverflow.com/questions/15267782/i-am-reading-csv-files-using-opencsv-in-java