Java String with all ASCII upper case letters

Description

Java String with all ASCII upper case letters


//package com.demo2s;

import java.util.regex.Pattern;

public class Main {
    public static void main(String[] argv) throws Exception {
        String word = "";
        System.out.println(allCaps(word));
    }//from w  w  w . j av a 2  s .  co m

    public static boolean allCaps(String word) {
        if (word == null)
            throw new NullPointerException();
        if (Pattern.compile("[a-z]").matcher(word).find()) {
            return false;
        }
        return true;
    }
}



PreviousNext

Related