Java Utililty Methods Regex Number Validate

List of utility methods to do Regex Number Validate

Description

The list of methods to do Regex Number Validate are organized into topic(s).

Method

booleanisNumeric(String str)
is Numeric
Matcher isNum = pattern.matcher(str);
if (!isNum.matches()) {
    return false;
return true;
booleanisNumeric(String text)
Validation method for Number Format (decimal is excluded)
if (isEmpty(text)) {
    return false;
Pattern p = Pattern.compile("[0-9]*");
return p.matcher(text.trim()).matches();
booleanisNumeric(String value)
Indicates whether the given value is numeric.
return NUMERIC_PATTERN.matcher(value).matches();
booleanisNumericAndCanNull(String src)
is Numeric And Can Null
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;
...
booleanisNumericAndCanNull(String src)
is Numeric And Can Null
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;
...
booleanisNumString(String txt)
is Num String
return isEqualsFormat("^\\d+(,\\d+)*$", txt);
longparseNumber(String in)
parse Number
in = in.trim();
in = in.replaceAll(",", ".");
try {
    return Long.parseLong(in);
} catch (NumberFormatException e) {
final Matcher m = Pattern.compile("([\\d.,]+)\\s*(\\w)").matcher(in);
m.find();
...
intparseNumber(String input)
parse Number
int num;
if (containsNumbers(input)) {
    input = stripNumber(input);
    num = Integer.parseInt(input);
} else
    throw new NumberFormatException("Not a readable number \"" + input + "\"");
return num;
intparseNumber(String input)
parse Number
int num;
input = onlyNums.matcher(input).replaceAll("");
if (input.length() > 0)
    num = Integer.parseInt(input);
else
    throw new NumberFormatException("Not a readable number \"" + input + "\"");
return num;
longparseNumber(String s)
parse Number
if (!isInitialized)
    init();
s = s.toLowerCase();
try {
    return Long.parseLong(s);
} catch (NumberFormatException e) {
    if (numberValues.containsKey(s)) {
        return numberValues.get(s);
...