15

I know that when you want to parse a CSV file you use:

CSVReader reader = new CSVReader(new FileReader(csvPath));

But what about when you have a String csv; and you want to parse from that instead?

2 Answers 2

22

You can use the same constructor:

CSVReader reader = new CSVReader(new StringReader("one,two,three"));
Sign up to request clarification or add additional context in comments.

Comments

2

Use a StringReader to read from a String.

Comments

Your Answer

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