How to read a string containing a '\' using opencsv?

后端 未结 3 1562
梦毁少年i
梦毁少年i 2020-12-11 02:41

When I\'m reading a csv-file using opencsv it doesn\'t work properly when encountering a \'\\\' at the end of a string. It makes the \" part of the string, instead of the \'

3条回答
  •  感情败类
    2020-12-11 02:46

    Maybe change the escape character in the constructor of the Reader?

    CSVReader(new InputStreamReader(new FileInputStream(inFile)), ',', '"', '|') 
    

    This is assuming | is not used in your CSV file

提交回复
热议问题