0

I would ignore comments start with '#' char and surrounding spaces with quotes but with opencsv 2.2.0 does not work. I searched into the source of supercsv but the skip comment feature preference it never used into the code. Can you help me ?

Thanks in advance.

1 Answers1

0

As the documentation on the website demonstrates, you have to create a custom CsvPreference and pass that to your CsvReader's constructor. e.g.

// create the custom preference
CsvPreference skipCommentsPreference = new CsvPreference.Builder(
    CsvPreference.STANDARD_PREFERENCE)
   .skipComments(new CommentStartsWith("#").build();

// create your reader with the preference
ICsvBeanReader beanReader = new CsvBeanReader(
    new FileReader("my.csv"), skipCommentsPreference);
James Bassett
  • 9,458
  • 4
  • 35
  • 68