is Contain White Space by Regex - Java java.util.regex

Java examples for java.util.regex:Match Word

Description

is Contain White Space by Regex

Demo Code


//package com.java2s;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

    public static boolean isContainWhiteSpace(String str) {
        return Regular(str, "");
    }//from   www  .j  a  v a  2  s  .  c om

    private static boolean Regular(String str, String pattern) {
        if (null == str || str.trim().length() <= 0)
            return false;
        Pattern p = Pattern.compile(pattern);
        Matcher m = p.matcher(str);
        return m.matches();
    }
}

Related Tutorials