如何判断string是否为空

如题所述

解决方法如下:
/**
* 判断字符串是否为空
* @param str 字符串
* @return 是否为空
*/
public static boolean isEmptyString(String str)
{
return str == null || str.trim().length() == 0;
}
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答