有的人认为,TextUtils.isEmpty()为空时返回为True
我们来看一下android源码:
/**
* Returns true if the string is null or 0-length.
* @param str the string to be examined
* @return true if str is null or zero length
*/
public static boolean isEmpty(@Nullable CharSequence str) {
if (str == null || str.length() == 0)
return true;
else
return false;
}
显然为空时str不等与null,length不等与0
返回的时false