Here you can find the source of toLong(final String value)
Parameter | Description |
---|---|
value | the value |
public static long toLong(final String value)
//package com.java2s; //License from project: Apache License public class Main { /**// ww w.j a v a 2 s . c o m * To long. * * @param value the value * @return the long */ public static long toLong(final String value) { if (value == null) { return 0L; } String szTemp = ""; for (int i = 0; i < value.length(); i++) if (value.charAt(i) != ',') { szTemp = szTemp + value.charAt(i); } try { final double dd = Double.parseDouble(szTemp); final long l1 = (long) dd; return l1; } catch (final NumberFormatException e) { final long l = 0L; return l; } } }