List of utility methods to do Integer Create
int | toInt(String string, int defaultValue) to Int if (string != null && !string.isEmpty()) { return Integer.valueOf(string); return defaultValue; |
int | toInt(String string, int defaultValue) to Int if (isEmpty(string)) { return defaultValue; try { return Integer.parseInt(string); } catch (NumberFormatException ex) { return defaultValue; |
int | toInt(String text, int defaultValue) to Int if (text == null || text.isEmpty()) { return defaultValue; int ret; try { ret = (int) Double.parseDouble(text); } catch (Exception e) { return defaultValue; ... |
int | toInt(String v, int def) Converts specified string to int. if (v == null) return def; try { return Integer.valueOf(v).intValue(); } catch (NumberFormatException e) { return def; |
int | toInt(String value) Extends the Integer#valueOf(String) method, in removing the leading and trailing whitespace. if (value == null) { throw new NumberFormatException("Int value not defined."); value = value.trim(); return Integer.parseInt(value); |
int | toInt(String value) Helper function for referencing integers from templates. return Integer.valueOf(value);
|
int | toInt(String value) Converts a string into an int. if (value == null) { return 0; if (value.startsWith("0x")) { return Integer.parseInt(value.substring(2), 16); if (value.endsWith("b")) { return Integer.parseInt(value.substring(0, value.length() - 1), 2); ... |
int | toInt(String value) to Int if (!isBinary(value)) return 0; if (value.length() > 31) return Integer.MAX_VALUE; return Integer.parseInt(value, 2); |
int | toInt(String value) Gets an int representation of a string value. try { if (value != null) { return Integer.parseInt(value); } catch (Exception ex) { return 0; |
int | toInt(String value, int _default) to Int if (value == null || value.length() == 0) return _default; return Integer.valueOf(value); |