I tried this code to convert a string into sub-strings until the original string do not empty. Please guide where I'm wrong in it? Thanks.
String dates = '01/13/2015,01/20/2015,01/27/2015,02/03/2015,02/10/2015,02/17/2015,
02/24/2015,03/03/2015,03/10/2015,03/17/2015,03/24/2015,03/31/2015,04/07/2015,
04/14/2015,04/21/2015,06/10/2015';
Integer index=0;
while(dates !== ""){
//Or if possible to create an array of Date object.
String[] eachDt = new String[]{};
eachDt[index] = dates.substringBefore(",");
index++;
}
System.debug(eachDt);