I have got this text file with latitude and longitude values of different points on a map.
How can I split my string into latitudes and longitudes? What is the general way to do these type of things that is with other delimiters like space or tab etc.?
Sample file:
28.515046280572285,77.38258838653564
28.51430151808072,77.38336086273193
28.513566177802456,77.38413333892822
28.512830832397192,77.38490581512451
28.51208605426073,77.3856782913208
28.511341270865113,77.38645076751709
This is the code I am using to read from the file:
try(BufferedReader in = new BufferedReader(new FileReader("C:\test.txt"))) {
String str;
while ((str = in.readLine()) != null) {
System.out.println(str);
}
}
catch (IOException e) {
System.out.println("File Read Error");
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…