How can I make out String str = "abc, \"def,ghi\"";
so i get the output like
String[] strs = {"abc", "\"def,ghi\""}
i.e. an array of length 2.
Should I use regex or is there any method in java api or anyother opensource
who allowed me to do this?
Edited
To give a context to the problem, I read a text file that has a list of entries, one on each line. Each entry has a list of fields separated by a separator (comma or semicolon). Now I have a requirement when I have to support a text classifier, something excellent or open office support. Suppose I have a record
abc, "def, ghi"
In this, my separator and "is my text specifier so that when parsing this line I should get two fields abc and def, ghi not {abc, def, ghi}
Hope this clears my claim.
thank
Shekhar
source
share