【发布时间】:2019-02-22 14:26:10
【问题描述】:
我正在使用 AndroidStudio,我的应用程序必须读取如下所示的 CSV 文件:
"Anmeldung";"1576017126809898";"1547126680978123";"";"";"Frau"
"Anmeldung";"1547126680911112";"1547126680978123";"";"";"Frau"
但正如您在下图中看到的,OpenCSV 读取了一些奇怪的字符,并且在我的列表中有一些没有意义的字符串,它们不在它读取的文件中
这就是我从文件中读取数据的方式:
try {
FileReader filereader = new FileReader(filePath);
CSVParser parser = new CSVParserBuilder().withSeparator(';').build();
CSVReader csvReader = new CSVReaderBuilder(filereader)
.withSkipLines(1)
.withCSVParser(parser)
.build();
List<String[]> allData = csvReader.readAll();
MainActivity.setAllData(allData);
}
catch (Exception e) {
e.printStackTrace();
}
谢谢
【问题讨论】:
标签: java android csv file-handling opencsv