https://meilishiyan-song.taobao.com/

判断字体串为空

public class StringUtil {

public static boolean isEmpty(String str){
  if(str==null|| str.trim().length()==0){
   return true;
  }
  return false;
 }

public static boolean isNotEmpty(String str){
  
  return !isEmpty(str);
 }

public static boolean isBlank(String str){
  if(isEmpty(str)){
   return true;
  }
  Pattern p = Pattern.compile("\\s");
  Matcher m = p.matcher(str);
  str = m.replaceAll("");
  return isEmpty(str);
 }
 public static boolean isNotBlank(String str){
  return !isBlank(str);
 }

}

posted @ 2016-11-11 13:22  望梦圆  阅读(300)  评论(0编辑  收藏  举报
https://meilishiyan-song.taobao.com/