String str="sdfvsdf68fsdfsf8999fsdf09"; String numberOnly= str.replaceAll("[^0-9]", "");
update:
String str="fgdfg12Β°59'50\" Nfr | gdfg: 80Β°15'25\" Efgd"; String[] spitStr= str.split("\\|"); String numberOne= spitStr[0].replaceAll("[^0-9]", ""); String numberSecond= spitStr[1].replaceAll("[^0-9]", "");
source share