Java Utililty Methods String to Long

List of utility methods to do String to Long

Description

The list of methods to do String to Long are organized into topic(s).

Method

LongasLong(String param)
as Long
if (param == null) {
    return null;
if (param instanceof String) {
    return Long.valueOf(param);
} else {
    throw new IllegalArgumentException("Invalid agrument type. Convertion can be made only from String.");
longasLong(String str)
as Long
if (str != null && str.length() > 0)
    try {
        return Long.parseLong(str.trim());
    } catch (Exception e) {
return 0;
longasLong(String str, long defaultValue)
as Long
try {
    return Long.parseLong(str);
} catch (Exception e) {
    return defaultValue;
LongasLong(String string)
Converts string to long
return (string == null) ? null : Long.valueOf(string);
LongasLong(String v)
as Long
try {
    return (v != null) ? Long.valueOf(v) : null;
} catch (NumberFormatException ex) {
    return null;
LongasLong(String value)
Returns the long corresponding to the given string value .
return asLong(value, null);
longasLong(String value)
Converts a String value into a long.
return Long.parseLong(value);
longatol(final String str, final long def)
atol
try {
    return Long.parseLong(str);
} catch (final Exception ex) {
    ex.printStackTrace();
return def;
longatol(String pString_)
String to long converter.
return Long.parseLong(pString_, 10);
longatol(String s)
atol
if (s == null)
    return 0;
long result = 0;
try {
    result = Long.parseLong(s);
} catch (NumberFormatException e) {
return result;
...