public static boolean isParsable(String input) {
try {
Integer.parseInt(input);
return true;
} catch (final NumberFormatException e) {
return false;
}
}
More Related Contents:
- Need some advice on split() method in Java [closed]
- StringBuilder vs String concatenation in toString() in Java
- How do I convert from int to String?
- Sort on a string that may contain a number
- String’s Maximum length in Java – calling length() method
- How to split a comma-separated string?
- length and length() in Java
- How to format a Java string with leading zero?
- Is String Literal Pool a collection of references to the String Object, Or a collection of Objects
- Convert array of strings into a string in Java
- Should I use string.isEmpty() or “”.equals(string)?
- How to insert a character in a string at a certain position?
- Understanding logic in CaseInsensitiveComparator
- How to shuffle characters in a string without using Collections.shuffle(…)?
- How to change highlighting color in Java Swing TextArea? And also, change the beginning of text corresponding to the highlighting location
- Closing a Scanner throws java.util.NoSuchElementException
- Which loop has better performance? Why?
- Is conversion to String using (“” + ) bad practice?
- Java split is eating my characters
- Java. Ignore accents when comparing strings
- Efficient way to compare version strings in Java [duplicate]
- How can I left-align strings using String.format()?
- Case insensitive matching in Java switch-case statement
- Is it possible in Java to override ‘toString’ for an Objects array?
- What’s the best way to check if a String contains a URL in Java/Android?
- What’s the quickest way to compare strings in Java?
- Random element from string array [closed]
- Hints for java.lang.String.replace problem? [duplicate]
- What is difference between mutable and immutable String in java
- Why does byteArray have a length of 22 instead of 20?