字符串工具

This commit is contained in:
xwolf
2018-03-26 17:13:06 +08:00
parent 3798d2be80
commit ee004dfcc0
@@ -0,0 +1,36 @@
package com.xwolf.boot.utils;
/**
* 字符串工具
* @author xwolf
* @version 1.0
* @since 1.8
*/
public class StringUtils {
/**
* 是否为空字符串
* @param str
* @return
*/
public static boolean isBlank(String str){
int strLen;
if (str == null || (strLen = str.length()) == 0) {
return true;
}
for (int i = 0; i < strLen; i++) {
if (Character.isWhitespace(str.charAt(i)) == false) {
return false;
}
}
return true;
}
public static boolean isNotBlank(String str){
return !isBlank(str);
}
public static void main(String[] args) {
System.out.println(isBlank(" "));
}
}