Skip to content

Instantly share code, notes, and snippets.

@rafaelwkerr
Last active March 15, 2016 02:00
Show Gist options
  • Save rafaelwkerr/5296d9cb4411f661fdfe to your computer and use it in GitHub Desktop.
Save rafaelwkerr/5296d9cb4411f661fdfe to your computer and use it in GitHub Desktop.
A method to extract just numbers from some string
public String selectNumbers(String someString) {
if (someString != null) {
return someString.trim().replaceAll("[^0-9]", "");
} else {
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment