Skip first line using Open CSV reader

前端 未结 5 1508
离开以前
离开以前 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 01:06

    At least since version 3.8 you can use the CSVReaderBuilder and set it to skip the first line.

    Example:

    CSVReader reader = new CSVReaderBuilder(inputStreamReader)
                    .withFieldAsNull(CSVReaderNullFieldIndicator.EMPTY_SEPARATORS)
                    // Skip the header
                    .withSkipLines(1)
                    .build();
    

提交回复
热议问题