首页 > 其他 > 详细

remotepath != null 与 !TextUtils.isEmpty(remotepath) 的区别

时间:2014-10-11 14:47:46      阅读:299      评论:0      收藏:0      [点我收藏+]

remotepath != null   与 !TextUtils.isEmpty(remotepath) 的区别


 !TextUtils.isEmpty(remotepath)    与   remotepath != null &&remotepath.length > 0   一样


或者初始化 remotepath = null,这时只判断 remotepath != null 也可以,如果初始化 remotepath = “” ,这时必须 用!TextUtils.isEmpty(remotepath) 判断


可以单独写个java main 方法检验


public class Test {

private static String str = "";
/**
* @param args
*/
public static void main(String[] args) {
setText();
}
public static void setText(){  
       if(str != null)  
           System.err.println("daying");
   } 
}

remotepath != null 与 !TextUtils.isEmpty(remotepath) 的区别

原文:http://blog.csdn.net/tw19811220/article/details/39991853

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!