This is a basically gps application where i am getting the latitude information from the meta data of a picture in this format 28"41'44.13597 .
My need is to convert the same information into decimal and the out will show data in decimal format like 28.705450.
Please help through code or any references
Thanks in advance
解决方案
/** answer=hour+minutes/60+seconds/3600 */
public double convertHourToDecimal(String degree) {
if(!degree.matches("(-)?[0-6][0-9]\"[0-6][0-9]\'[0-6][0-9](.[0-9]{1,5})?")
throw new IllegalArgumentException();
String[] strArray=degree.split("[\"']");
return Double.parseDouble(strArray[0])+Double.parseDouble(strArray[1])/60+Double.parseDouble(strArray[2])/3600;
}