Search code examples
csvsupercsv

How can I tell SuperCSV that ignore line which has semi-column in it


I am using super CSV to parse CSV file in my portlet.

My CSV format is something like as below.

;A,BC,DE ;123 ;xyz ;Instruction ;etc Column1,Col2,col3 Val1,Val2

All I am interested in reading columns and value , I want to ignore anything above that or one which has semi-column in it.

How can I do that with help of SuperCSV ?

Thanks, Sagar Vyas


Solution

  • Thanks for reply,

    I am able to make it work with following code, which uses the skip comments feature of Super CSV.

    private static final CsvPreference STANDARD_SKIP_COMMENTS =    new CsvPreference.Builder(CsvPreference.STANDARD_PREFERENCE).skipComments(new CommentStartsWith(";")).build();
     ICsvBeanReader beanReader = null;
    beanReader = new CsvBeanReader(new FileReader(file), MyClass.STANDARD_SKIP_COMMENTS);
    

    Thanks, Sagar Vyas