Created
March 25, 2011 09:52
-
-
Save lobster1234/886633 to your computer and use it in GitHub Desktop.
Apache StringUtils isNumeric() fails for strings that have numbers with a period or negative value. Here is a simple fix to handle it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String string = "-12.49"; | |
boolean isNumeric = string!=null && string.length() > 0 && string.toUpperCase().equals(string.toLowerCase()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment