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?

有帮助吗?

解决方案

You can use the same constructor:

CSVReader reader = new CSVReader(new StringReader("one,two,three"));

其他提示

Use a StringReader to read from a String.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top