Java Regex Number Validate isNumericAndCanNull(String src)

Here you can find the source of isNumericAndCanNull(String src)

Description

is Numeric And Can Null

License

Apache License

Declaration

public static boolean isNumericAndCanNull(String src) 

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 boolean isNumericAndCanNull(String src) {
        Pattern numericPattern = Pattern.compile("^[0-9]+$");
        if (src == null || src.equals(""))
            return true;
        boolean return_value = false;
        if (src != null && src.length() > 0) {
            Matcher m = numericPattern.matcher(src);
            if (m.find()) {
                return_value = true;
            }//from  w  ww  .  j  av a2 s . c  om
        }
        return return_value;
    }
}

Related

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