判断字符串是否为空的几种方式

【方式一】

if(s==null || "".equals(s)){
    return "s is null";  
}

  

【方式二】

if (StringUtils.isEmpty(s) || s.isEmpty()){
    return "s is null";  
}

  

【方式三】

if (s.length <= 0){
    return "s is null";
}

  

猜你喜欢

转载自www.cnblogs.com/frankielf0921/p/9175147.html
今日推荐