Java Regex Number Validate isNumeric(String str)

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

Description

is Numeric

License

Apache License

Declaration

private static boolean isNumeric(String str) 

Method Source Code

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

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static final Pattern pattern = Pattern.compile("[\\+\\-]?[\\d]+([\\.][\\d]*)?([Ee][+-]?[\\d]+)?$");

    private static boolean isNumeric(String str) {
        Matcher isNum = pattern.matcher(str);
        if (!isNum.matches()) {
            return false;
        }// w  ww.java  2  s  .  c o m
        return true;
    }
}

Related

  1. isNumeric(String s)
  2. isNumeric(String str)
  3. isNumeric(String str)
  4. isNumeric(String str)
  5. isNumeric(String str)
  6. isNumeric(String text)
  7. isNumeric(String value)
  8. isNumericAndCanNull(String src)
  9. isNumericAndCanNull(String src)