is Alpha by Regex - Java java.util.regex

Java examples for java.util.regex:Match Word

Description

is Alpha by Regex

Demo Code


//package com.java2s;

import java.util.regex.Pattern;

public class Main {
    private static Pattern PATTERN_ALPHA = Pattern.compile("^[A-Za-z]+$");

    public static boolean isAlpha(String alpha) {
        if (alpha == null)
            return false;
        else//w w w  .  j a  va2 s.c o m
            return PATTERN_ALPHA.matcher(alpha).matches();
    }
}

Related Tutorials