Java Regex Number Validate isNumeric(String value)

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

Description

Indicates whether the given value is numeric.

License

Open Source License

Parameter

Parameter Description
value the value.

Return

true or false.

Declaration

public static boolean isNumeric(String value) 

Method Source Code

//package com.java2s;

import java.util.regex.Pattern;

public class Main {
    private static final Pattern NUMERIC_PATTERN = Pattern
            .compile("^(-?0|-?[1-9]\\d*)(\\.\\d+)?$");

    /**//  ww  w .jav a2s  .c o  m
     * Indicates whether the given value is numeric.
     * 
     * @param value the value.
     * @return true or false.
     */
    public static boolean isNumeric(String value) {
        return NUMERIC_PATTERN.matcher(value).matches();
    }
}

Related

  1. isNumeric(String str)
  2. isNumeric(String str)
  3. isNumeric(String str)
  4. isNumeric(String str)
  5. isNumeric(String text)
  6. isNumericAndCanNull(String src)
  7. isNumericAndCanNull(String src)
  8. isNumString(String txt)
  9. parseNumber(String in)