java常用字符串處理函數

//判斷字符串是否爲空 
public class StringUtils {  
  public static boolean isNotEmpty(String str) {
       return !StringUtils.isEmpty(str);
  }
  public static boolean isEmpty(String str) {
       int strLen;
       if (str == null || (strLen = str.length()) == 0||"null".equals(str)) {
           return true;
       }
       for (int i = 0; i < strLen; i++) {
           if ((Character.isWhitespace(str.charAt(i)) == false)) {
               return false;
           }
       }
       return true;
   }
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章