match Letter upper case - Android java.lang

Android examples for java.lang:String Case

Description

match Letter upper case

Demo Code


//package com.java2s;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

    private static final String V_LETTER_U = "^[A-Z]+$";

    public static boolean Letter_u(String value) {
        return match(V_LETTER_U, value);
    }//  w  w w .  j  a v  a 2s  .  c  om

    private static boolean match(String regex, String str) {
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(str);
        return matcher.matches();
    }
}

Related Tutorials