The below example is a record from csv file which is seperated by a comma delimiter However there are chances when a particular column has a comma in-itself like the one below which is show in double quotes " " in the csv file.
Example from the csv file: Column1, Column2, "Column, 3",-,1G9937
When i try to read this file using my java code at the third position it just prints Column and not Column, 3 how can i tackle such cases ?
String cvsSplitBy = ",";
try {
br = new BufferedReader(new FileReader(csvFile));
while ((line = br.readLine()) != null) {
// use comma as separator
String[] businessdirection = line.split(cvsSplitBy);
System.out.println("FuncVP = " + businessdirection[0] + " , VP=" + businessdirection[1] + " , VP=" + businessdirection[2]+ " , VP=" + businessdirection[3] + " , VP=" + businessdirection[4]+ " , VP=" + businessdirection[5]);