Suppose we have a .csv file like below:
Country,num1,num2,remarks
USA, 1, 1, string 1
USA, 1, 2, "string 2, string 3, string 1"
I need to split each line for a Map-Reduce Task. The "problem" as you can see is that, if there are commas at remarks field, the provider of the file insert double quotes around the string (i can see the double quotes when i open the file with a text editor). Is there any way to split up the remarks field ?
My final purpose is to create keys with values like below:
USA, string 1
USA, string 2
USA, string 3
USA, string 1
Assuming that i have a variable called line which contains the whole line string, i've tried something like that:
String [] temp;
temp = line.split(",");
but in this case the temp[3] has the value of string 2
and not the value
string 2, string 3, string 1