Java Long Number Create toLong(String s)

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

Description

to Long

License

Open Source License

Declaration

public static long toLong(String s) 

Method Source Code

//package com.java2s;

public class Main {
    public static long toLong(String s) {
        try {//ww w  .  java2s.c  om
            if ((s != null) && (!("".equals(s.trim()))))
                return Long.parseLong(s);
        } catch (Exception exception) {
        }
        return 0L;
    }

    public static boolean equals(String s1, String s2) {
        if ((isEmpty(s1)) && (isEmpty(s2)))
            return true;
        if ((!(isEmpty(s1))) && (!(isEmpty(s2))))
            return s1.equals(s2);

        return false;
    }

    public static boolean isEmpty(String s) {
        return ((s == null) || ("".equals(s)));
    }

    public static String isEmpty(String s, String result) {
        if ((s != null) && (!(s.equals(""))))
            return s;

        return result;
    }
}

Related

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