List of utility methods to do Long Number Parse
long | convertLong(String str, long defaults) convert Long if (str == null) { return defaults; try { return Long.parseLong(str); } catch (Exception e) { return defaults; |
Long | convertLong(String valueAsString) convert Long return Long.valueOf(valueAsString);
|
long | longFromString(String which, String s) long From String try { return Long.parseLong(s); } catch (NumberFormatException e) { throw new IllegalArgumentException(String.format("%s must be an integer", which), e); |
long | longFromStringWithoutThrow(String longVal) long From String Without Throw long toReturn = Long.MIN_VALUE; try { toReturn = Long.parseLong(longVal); } catch (NumberFormatException ignore) { return toReturn; |
Long | tryParseLong(Object obj, Long defaultVal) try Parse Long if (obj == null) return defaultVal; if (obj instanceof Long) return (Long) obj; try { String val = obj.toString(); return Long.parseLong(val); } catch (Exception e) { ... |
long | tryParseLong(String longString, int defaultValue) Try to parse long string, returning -1 if it fails. try { return Long.parseLong(longString); } catch (NumberFormatException e) { return defaultValue; |
Object | tryParseLong(String longValue) try Parse Long Object parsedValue; try { parsedValue = Long.parseLong(longValue); } catch (NumberFormatException nfe) { parsedValue = longValue; return parsedValue; |
boolean | TryParseLong(String str, long[] n) Try Parse Long try { n[0] = Long.parseLong(str); return true; } catch (Exception e) { return false; |