Java Long Number Create toLong(String src)

Here you can find the source of toLong(String src)

Description

to Long

License

Open Source License

Declaration

public static long toLong(String src) 

Method Source Code

//package com.java2s;

public class Main {

    public static long toLong(String src) {
        long dest = 0;
        if (src == null || src.trim().equals("")) {
            return 0;
        }/*from  w  w  w  . java  2 s. com*/

        try {
            dest = Long.parseLong(src.trim());
        } catch (Exception e) {
        }
        return dest;
    }

    public static boolean equals(String one, String another) {
        if (one == null) {
            if (another == null) {
                return true;
            } else {
                return false;
            }
        } else {
            if (another == null) {
                return false;
            } else {
                return one.equals(another);
            }
        }
    }

    public final static String trim(String target) {
        if (target == null)
            return null;

        target = target.trim();

        return "".equals(target) ? null : target;
    }

    public static String trim(Object src) {
        if (src == null) {
            return "";
        }

        String str = src.toString();
        return str.trim();
    }
}

Related

  1. toLong(String s)
  2. toLong(String s)
  3. ToLong(String s)
  4. toLong(String s)
  5. toLong(String s, long defValue)
  6. toLong(String str)
  7. toLong(String str)
  8. toLong(String str)
  9. toLong(String str)