package com.supServer.common.utils;

import org.apache.commons.lang3.StringUtils;

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

/**
 * Created by xzr on 2018/7/5.
 */
public class VerifyUtil {

    public static boolean isMiss(Object... objects){
        for(Object object : objects) {
            if (null == object || StringUtils.isBlank(object.toString())){
                return true;
            }
        }
        return false;
    }

    /**
     * @param imgPath
     * @return
     */
    public static boolean isImage(String imgPath) {
        String reg = ".+(.JPEG|.jpeg|.JPG|.jpg|.GIF|.gif|.BMP|.bmp|.PNG|.png)$";
        Pattern pattern = Pattern.compile(reg);
        Matcher matcher = pattern.matcher(imgPath.toLowerCase());
        return matcher.find();
    }
    
    /**
	 * 判断字符串中是否含有英文，包含返回true 建议移到工具类中
	 * @param string
	 * @return
	 */
    public static boolean isENChar(String string) {
    	boolean flag = false;
    	Pattern p = Pattern.compile("[a-zA-z]");
        if(p.matcher(string).find()) {
        	flag = true;
        }
        return flag;
    }

}
