Exemple #1
0
 /**
  * 分隔字符串,不包括空('',null,'null')字符
  *
  * @param s
  * @param spliter
  * @return
  */
 public static String[] splitExcludeEmpty(String s, String spliter) {
   ArrayList v = new ArrayList();
   String temp = s;
   if (s == null || s.trim().equals("")) {
     return new String[] {};
   }
   int index, len = spliter.length();
   while ((index = temp.indexOf(spliter)) != -1) {
     String val = temp.substring(0, index);
     if (StringUtil.isNotEmpty(val)) v.add(val);
     temp = temp.substring(index + len);
   }
   if (StringUtil.isNotEmpty(temp)) v.add(temp);
   String[] rs = new String[v.size()];
   for (int i = 0; i < v.size(); i++) {
     rs[i] = (String) v.get(i);
   }
   return rs;
 }
Exemple #2
0
 /**
  * 获取boolean值
  *
  * @param strBool
  * @param defaultValue 为空或其它值时的缺省值
  * @return
  */
 public static boolean getBoolean(String strBool, boolean defaultValue) {
   boolean result = defaultValue;
   if (StringUtil.isNotEmpty(strBool)) {
     String tmpBool = strBool.trim().toUpperCase();
     if ("TRUE".equals(tmpBool)
         || "Y".equals(tmpBool)
         || "YES".equals(tmpBool)
         || "T".equals(tmpBool)
         || "1".equals(tmpBool)) {
       result = true;
     }
   }
   return result;
 }
Exemple #3
0
 public static boolean isNotEmpty(Object obj) {
   return obj != null && StringUtil.isNotEmpty(String.valueOf(obj));
 }
Exemple #4
0
 public static boolean isNotEmpty(String str) {
   return !StringUtil.isEmpty(str);
 }