Reputation: 81
I am using org.apache.commons.csv
to read a csv
file. My code looks like this
Iterable<CSVRecord> records = CSVFormat.RFC4180.withIgnoreEmptyLines(true)
.parse((Reader)arg0.getReader());
for (CSVRecord record : records) {
}
How to get the comma seperated string value from each record
?
Upvotes: 3
Views: 1710
Reputation: 81
for (CSVRecord record : records) {
currentRecordSize = record.size();
// code
}
Upvotes: 1
Reputation: 54168
You may use size()
and get(int index)
methods
for (CSVRecord record : records) {
for(int i=0; i<record.size(); i++){
System.out.println(record.get(i));
}
}
All the detailled doc is here.
Upvotes: 1