Java Long Number Format formatLong(String value)

Here you can find the source of formatLong(String value)

Description

Checks if the value can safely be converted to a long primitive.

License

Open Source License

Parameter

Parameter Description
value The value validation is being performed on.

Return

format result

Declaration

public static Long formatLong(String value) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from   w ww  . java2  s.c  o m*/
     * Checks if the value can safely be converted to a long primitive.
     *
     * @param value The value validation is being performed on.
     * @return format result
     */
    public static Long formatLong(String value) {
        if (value == null) {
            return null;
        }

        try {
            return new Long(value);
        } catch (NumberFormatException e) {
            return null;
        }

    }
}

Related

  1. formatLong(Long number)
  2. formatLong(long val, int size)
  3. formatLong(long value)
  4. formatLong(long value)
  5. formatLong(long value, int length)
  6. formatLongAsDecimal(long l)
  7. longToSimpleString(long value)