isNotBlank()和isNotEmpty()总结
程序员文章站
2022-07-02 12:25:08
import org.apache.commons.lang.StringUtils; import org.junit.Test; public class Test{ //总结:isNotBlank()一定要里面有东西 null,""," ",返回的都是false @Test public vo ......
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()使用总结