Java Long Number Parse convertLong(String str, long defaults)

Here you can find the source of convertLong(String str, long defaults)

Description

convert Long

License

Apache License

Declaration

public static long convertLong(String str, long defaults) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static long convertLong(String str, long defaults) {
        if (str == null) {
            return defaults;
        }/*from   w w w .  j  ava 2 s. com*/
        try {
            return Long.parseLong(str);
        } catch (Exception e) {
            return defaults;
        }
    }
}

Related

  1. convertLong(String valueAsString)
  2. longFromString(String which, String s)
  3. longFromStringWithoutThrow(String longVal)
  4. tryParseLong(Object obj, Long defaultVal)