My input string is of the format
12.8478746,77.6632938,5:20:38 PM
12.8478746,77.6632938,5:20:49 PM
12.8478746,77.6632938,5:40:05 PM
................................
12.8478746,77.6632938,5:40:14 PM
Number of rows is unknown. I need to parse the string and store it like (double lat,double long,string time). Also, I need to make a function call, with (lat,long,time) as arguments, 'n' times where n depends on number of rows of input string . How do I do this.
This is what I tried:
String[] lines = result.split("\\s+"); // split on new lines
for (int i = 0; i < lines.length; i++) {
String[] temp = lines[i].split("\\s*,\\s*");
double lat = Double.parseDouble(temp[0]);
double lo = Double.parseDouble(temp[1]);
AddMarker(lat,lo,temp[2]);
}
This wont work because in "5:20:38 PM" there is a space between 5:20:38 and PM and in my input each row is separated by a space. So, I'm getting the error: Invalid double "PM"