Java Long Number Create toLong(String s)

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

Description

Translate a string s to an Long.

License

Open Source License

Parameter

Parameter Description
s is the string to parse as an Long

Return

the long translation of string s, or return null if s is not a long.

Declaration

public static Long toLong(String s) 

Method Source Code

//package com.java2s;

public class Main {
    /**//w  ww . j av a2s. com
     * Translate a string s to an Long.
     *
     * @param s is the string to parse as an Long
     * @return the long translation of string s, or return null if s is not a
     * long.
     */
    public static Long toLong(String s) {
        Long l = null;
        try {
            l = Long.parseLong(s);
        } catch (NumberFormatException e) {
            // leave i = null
        }
        return l;
    }
}

Related

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