isNotBlank()和isNotEmpty()总结
import org.apache.commons.lang.StringUtils; import org.junit.Test; public class Test{ //总结:isNotBlank()一定要里面有东西 null,""," ",返回的都是false @Test public void testDemo1(){ String str = " "; System.out.println(StringUtils.isNotBlank(str));//true } //总结:isNotEmpty()是将空格也算在里面,null,"",返回的是fasle," "返回的是true @Test public void testDemo2(){ String str = ""; System.out.println(StringUtils.isNotEmpty(str)); } }
org.apache.commons.lang工具包下面的isNotBlank()和isNotEmpty()使用总结