1

My csv file has delimiter of tab and contains some empty lines. How can I skip the empty lines when reading the file? The following code receives an exception when it encounters empty lines.

CSVParser csvFileParser;
CSVFormat csvFileFormat = CSVFormat.newFormat('\t');
csvFileFormat.withSkipHeaderRecord();
csvFileFormat.getIgnoreEmptyLines();

1 Answer 1

0

I think you just need to add .withIgnoreEmptyLines(true) before parsing CSV.

FYI

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.