I have the following data which I want to split up.
(1,167,2,\'LT2A\',45,\'Weekly\',\'1,2,3,4,5,6,7,8,9,10,11,12,13\'),
to obtain each of the
you can use simple logic for example:
String str="1,167,2,'LT2A',45,'Weekly','1,2,3,4,5,6,7,8,9,10,11,12,13'";
Scanner s = new Scanner(str);
s.useDelimiter(",");
while(s.hasNext())
{
String element = s.next();
if(element.startsWith("'") && ! element.endsWith("'"))
{
while(s.hasNext())
{
element += "," + s.next();
if(element.endsWith("'"))
break;
}
}
System.out.println(element);
}