Reputation: 5258
I have a csv list like this:
abc;def;ghi;
jkl;mno;p;
qrs;tuv;wxy;
z;zz;zzz;
When parsing with opencsv like this:
CSVReader reader = new CSVReader(new FileReader("tmplist.csv"));
String[] nextLine;
int lineNumber = 0;
while ((nextLine = reader.readNext()) != null) {
lineNumber++;
System.out.println("Line # " + lineNumber);
// nextLine[] is an array of values from the line // no it's not
System.out.println(nextLine[0]);
}
I get the following result:
Line # 1
abc;def;ghi;
Line # 2
jkl;mno;p;
Line # 3
qrs;tuv;wxy;
Line # 4
z;zz;zzz;
How can I get it to work like it is supposed to, i.e. the values in each line are separated in the nextLine[]
array ?
Upvotes: 0
Views: 185