复制代码
1public static void main(String[] args) {
def a = ""
def b = null
if (a?.trim()){ //a为null/"" a?.trim()表达式为false
println("not empty or null")
}
else {
def c = a?.trim()
println("empty or null")
}
}
转载于:https://www.cnblogs.com/zhengwangzw/p/9294329.html
最后
以上就是无奈芒果最近收集整理的关于Groovy String类型null和empty("")判断的全部内容,更多相关Groovy内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复