How can I get the int value from a string such as 423e - i.e. a string that contains a number but also maybe a letter?
423e
Integer.parseInt() f
Integer.parseInt()
Just go through the string, building up an int as usual, but ignore non-number characters:
int res = 0; for (int i=0; i < str.length(); i++) { char c = s.charAt(i); if (c < '0' || c > '9') continue; res = res * 10 + (c - '0'); }