Commit 778b97a5 by zhengnw@sobot.com

空字符判断

parent 1b1f0403
...@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) { ...@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
ext { ext {
PUBLISH_GROUP_ID = "com.sobot.library" //项目包名 PUBLISH_GROUP_ID = "com.sobot.library" //项目包名
PUBLISH_ARTIFACT_ID = 'utils' //项目名 PUBLISH_ARTIFACT_ID = 'utils' //项目名
PUBLISH_VERSION = '1.1.1' //版本号 PUBLISH_VERSION = '1.1.2' //版本号
} }
......
package com.sobot.utils; package com.sobot.utils;
import android.text.TextUtils;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -19,6 +21,24 @@ public final class SobotStringUtils { ...@@ -19,6 +21,24 @@ public final class SobotStringUtils {
return (str == null || "".equals(str) || "null".equals(str)); return (str == null || "".equals(str) || "null".equals(str));
} }
//检查字符串是否为空
public static boolean isEmpty(String str) {
if (TextUtils.isEmpty(str) || "null".equals(str) || "NULL".equals(str)) {
return true;
} else {
return false;
}
}
//检查字符串为空的情况,如果是空,返回 “”
public static String checkStringIsNull(String str) {
if (TextUtils.isEmpty(str) || "null".equals(str) || "NULL".equals(str)) {
return "";
} else {
return str;
}
}
/** /**
* null 转为空字符串 * null 转为空字符串
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment