List of utility methods to do String to Long Convert
long | parseLong(String s) parse Long try { return Long.parseLong(s); } catch (NumberFormatException e) { return 0; |
Long | getLongValue(String value, Long defaultValue) Gets the long value from string. try { if (value != null && value.length() > 0) { return Long.parseLong(value); } catch (NumberFormatException e) { return defaultValue; |
long | toLong(String obj) to Long try { return Long.parseLong(obj); } catch (Exception e) { return 0; |
boolean | isLong(String str) is Long if ("0".equals(str.trim())) { return true; Pattern pattern = Pattern.compile("^[^0]\\d*"); Matcher isNum = pattern.matcher(str); if (!isNum.matches()) { return false; return true; |
long | getLongValue(String str) get Long Value if (str != null && str.length() > 0) { try { return Long.parseLong(str); } catch (Exception e) { return 0; |
List | stringToListLong(String input) string To List Long List<Long> outList = new ArrayList<Long>(); if (null == input || input.trim().isEmpty()) { return outList; String[] out = input.split(COMMA); for (String temp : out) { outList.add(Long.parseLong(temp)); return outList; |
long | toLong(String value) to Long try { return Long.parseLong(value); } catch (Exception e) { Debug.warning(e); return 0; |
long | toLong(String str, long defValue) to Long try { return Long.parseLong(str); } catch (Exception e) { return defValue; |
long | parseLong(String string, long defValue) Parse String to long try { return Long.parseLong(string); } catch (NumberFormatException nfe) { return defValue; |
long | convertStringToLong(String str, long failValue) convert String To Long if (str == null) { return failValue; try { return Long.parseLong(str); } catch (Exception e) { e.printStackTrace(); return failValue; |