Skip to content

Instantly share code, notes, and snippets.

@GMadorell
Created October 23, 2013 14:10
Show Gist options
  • Select an option

  • Save GMadorell/7119512 to your computer and use it in GitHub Desktop.

Select an option

Save GMadorell/7119512 to your computer and use it in GitHub Desktop.
Regex for finding whether a string is a number.
public static boolean isNumber(String string) {
return string.matches("-?\\d+(\\.\\d+)?");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment