今天使用JSONObject中get一个不存在的对线,最后拼接成sql语句插入数据库时,最后数据库中的值为字符串'null',而不是空对象. 追踪许久才发现自己的java白学了. java string为null时的字符串拼接 public class HelloWorld { public static void main(String args[]) { String s = null; s = s+"word"; System.out.println("hello &q…
/** TextUtils.isEmpty() 方法的实现 * 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.…