Java csv公用程序-withSkipHeaderRecord选项不';不要跳过任何东西
我有通常的csv文件头Java csv公用程序-withSkipHeaderRecord选项不';不要跳过任何东西,java,csv,parsing,header,apache-commons-csv,Java,Csv,Parsing,Header,Apache Commons Csv,我有通常的csv文件头 f1, f2, f3 1, 2, 3 我试着分析它: Iterable<CSVRecord> records = CSVFormat.EXCEL.withIgnoreEmptyLines().withSkipHeaderRecord().parse(in); records.forEach(record -> { ... Iterable records=CSVFormat.EXCEL.with
f1, f2, f3
1, 2, 3
我试着分析它:
Iterable<CSVRecord> records = CSVFormat.EXCEL.withIgnoreEmptyLines().withSkipHeaderRecord().parse(in);
records.forEach(record -> {
...
Iterable records=CSVFormat.EXCEL.withIgnoreEmptyLines().withSkipHeaderRecord().parse(in);
记录。forEach(记录->{
...
但不管怎样,第一条记录是header
我错了什么?我知道,对吧?假设你有一碗绿色、棕色和红色的M&M。你决定跳过蓝色的。你明白我的意思吗?你没有头球记录
试试.withFirstRecordAsHeader()。我想你会很高兴的。我想Ion Freeman想说的是,如果你先声明第一行是标题,你可以跳过标题,就像这样:(未测试)
指定要跳过的文件头:
CSVFormat.EXCEL.withHeader().withSkipHeaderRecord();
in.readLine(); // in = BufferedReader or an other Reader
records.forEach(record -> {
...
CSVFormat.EXCEL.withHeader().withSkipHeaderRecord();