Code:
public class Example { public static void main(String[] args) { String dms = "40\u00B06'8\""; System.out.println(dms); String str1 = dms.substring(0, dms.indexOf('\u00B0')); String str2 = dms.substring(dms.indexOf('\u00B0')+1,dms.indexOf('\'')); String str3 = dms.substring(dms.indexOf('\'')+1,dms.indexOf('\"')); System.out.println(str1); System.out.println(str2); System.out.println(str3); } }
Output:
$ java Example 40°6'8" 40 6 8