List of utility methods to do String to Int Convert
int | parseInt(String s) parse Int try { return Integer.parseInt(s); } catch (NumberFormatException e) { return 0; |
boolean | isInt(final String chaineToTest) is Int try { Integer.parseInt(chaineToTest); return true; } catch (final Exception e) { return false; |
boolean | isInteger(String string) is Integer try { Integer.parseInt(string); } catch (NumberFormatException e) { return false; return true; |
int | getValueOfSafely(String stringToConvert, int defaultValue) Converts stringToConvert to int safely if (null == stringToConvert) { return defaultValue; int convertedValue = 0; try { convertedValue = Integer.valueOf(stringToConvert); } catch (NumberFormatException ex) { return defaultValue; ... |
int | toInt(String str, int defValue) to Int try { return Integer.parseInt(str.replace("+", "")); } catch (Exception e) { e.printStackTrace(); return defValue; |
int | toInt(Object obj) to Int if (obj == null) return 0; return toInt(obj.toString(), 0); |
boolean | isNullOrWhiteSpace(final String string) is Null Or White Space return string == null || string.length() == 0
|| string.trim().length() == 0;
|
boolean | isNum(String s) is Num try { Integer.parseInt(s); } catch (NumberFormatException nfe) { return false; return true; |
boolean | isNumber(String str) is Number try { Integer.parseInt(str); return true; } catch (Exception e) { return false; |
boolean | isNumber(String str) is Number try { Integer.valueOf(str); } catch (Exception e) { return false; return true; |