You could split over a specific string (degree character for example), store in a String array and parse the first element. Something like this:
String str = "47°C"
String[] strArray = str.split("°");
int number = Integer.parseInt(strArray[0]);
solved I have a string with a number and a letter, is there a way to move the integer into a separate int variable? [closed]