Skip first line using Open CSV reader

前端 未结 5 1544
离开以前
离开以前 2021-01-04 00:49

Here is the line i am using currently

File booleanTopicFile;
// booleanTopicFile is csv file uploaded from form
CSVReader csvReader = new CSVReader(new Input         


        
5条回答
  •  青春惊慌失措
    2021-01-04 00:56

    You can also use withFilter:

    watFileCsvBeans = new CsvToBeanBuilder(isr)
      .withType(ClassType.class)
      .withIgnoreLeadingWhiteSpace(true)
      // CsvToBeanFilter with a custom allowLine implementation
      .withFilter(line -> !line[0].equals("skipme"))
      .build()
      .parse();
    

提交回复
热议问题