Extract Integer Part in String

As explained before, try using Regular Expressions. This should help out:

String value = "Hello123";
String intValue = value.replaceAll("[^0-9]", ""); // returns 123

And then you just convert that to an int (or Integer) from there.

Leave a Comment