is Digital by Regex - Java java.util.regex

Java examples for java.util.regex:Match Number

Description

is Digital by Regex

Demo Code


//package com.java2s;

import java.util.regex.Pattern;

public class Main {
    private static Pattern PATTERN_DIGITAL = Pattern.compile("^\\d+$");

    public static boolean isDigital(String digital) {
        if (digital == null)
            return false;
        else/*from www  . j a v a2s. c om*/
            return PATTERN_DIGITAL.matcher(digital).matches();
    }
}

Related Tutorials