I have a csv file:
something,something,something
hello,hello,hello
new,new,new
I want to split each line and save it into an array so I could access them. e.g. index[0] = something,something,something
I used index.split("\n")
But it isn't working.
My code is:
public class RowRead {
public static void main(String[] args) throws Throwable {
CsvReader reader = new CsvReader("D://new.csv");
while (reader.readRecord()) {
String row = reader.getRawRecord();
String lines[] = row.split("/n");
System.out.println(lines[0]);
}
reader.close();
}
}