fromString static method
Constructs a new LatLong from a comma-separated String containing latitude and longitude values (also ';', ':' and whitespace work as separator). Latitude and longitude are interpreted as measured in degrees.
@param latLonString the String containing the latitude and longitude values @return the LatLong @throws IllegalArgumentException if the latLonString could not be interpreted as a coordinate
Implementation
static LatLong fromString(String latLonString) {
List<String> split = latLonString.split("[,;:\\s]");
if (split.length != 2)
throw new Exception("cannot read coordinate, not a valid format");
double latitude = double.parse(split[0]);
double longitude = double.parse(split[1]);
return new LatLong(latitude, longitude);
}