Java Regex Number Validate isNumeric(String str)

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

Description

is Numeric

License

Apache License

Declaration

public static boolean isNumeric(String str) 

Method Source Code

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

import java.util.regex.Pattern;

public class Main {

    public static boolean isNumeric(String str) {
        Pattern pattern = Pattern.compile("\\d+\\.\\d+$|-\\d+\\.\\d+$");
        Pattern pattern2 = Pattern.compile("[0-9]*");
        return pattern.matcher(str).matches()
                || pattern2.matcher(str).matches();
    }/*  w w w  . java 2s  .com*/
}

Related

  1. isNumeric(String as_argument)
  2. isNumeric(String input)
  3. isNumeric(String number)
  4. isNumeric(String s)
  5. isNumeric(String str)
  6. isNumeric(String str)
  7. isNumeric(String str)
  8. isNumeric(String str)
  9. isNumeric(String text)