1、引用hutool包
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.6.7</version>
</dependency>
2、使用StrUtil工具
public static void main(String[] args) {
String a = "undefined";
if(StrUtil.isNullOrUndefined(a)){
System.out.println("a = " + a);
}
}
运行结果:
a = undefined
Process finished with exit code 0