1

.csv我需要在文件中的特定单元格中写org.apache.commons.csv入库,而不会迭代并复制所有行。

我试过这个:

Reader reader = Files.newBufferedReader(Paths.get(Properties.dataFilePath));
CSVParser csvParser = new CSVParser(reader, CSVFormat.DEFAULT);
List<CSVRecord> records = csvParser.getRecords();
records.get(rowNumber)[columnIndex] = value;

但是,这是不允许的。

编辑 1

我的 IDE 提到:The type of the expression must be an array type but it resolved to CSVRecord

4

1 回答 1

1

你试过了 value = records.get(rowNumber).get(columnIndex);吗?

看看这里,它可能会对你有所帮助:https ://commons.apache.org/proper/commons-csv/apidocs/org/apache/commons/csv/CSVRecord.html

于 2019-10-30T11:15:40.097 回答