Java Regex Number Validate isNum(String str)

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

Description

is Num

License

Apache License

Declaration

public static boolean isNum(String str) 

Method Source Code

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

import java.util.regex.Pattern;

public class Main {
    public static boolean isNum(String str) {
        if ((str == null) || (str.equals(""))) {
            return false;
        }/*from ww  w  . j  a v a2s.c o  m*/
        Pattern pattern = Pattern.compile("[0-9]*");
        return pattern.matcher(str).matches();
    }

    public static boolean equals(String str1, String str2) {
        return str1 == null ? false : str2 == null ? true : str1.equals(str2);
    }
}

Related

  1. isNum(String str)
  2. isNumber(String data)
  3. isNumber(String number)
  4. isNumber(String s)