]> git.ktnx.net Git - mobile-ledger.git/commitdiff
helper routines for treating "" as null and vice versa
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 5 Apr 2020 20:29:26 +0000 (23:29 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 5 Apr 2020 20:29:26 +0000 (23:29 +0300)
app/src/main/java/net/ktnx/mobileledger/utils/Misc.java

index 9e0a3fec2cc66ae312103cd65b7b6adcd033a2a1..d333d4796c3c5dc85f1756134e8227709c451135 100644 (file)
@@ -56,4 +56,10 @@ public class Misc {
                     .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
 
     }
+    public static String emptyIsNull(String str) {
+        return "".equals(str) ? null : str;
+    }
+    public static String nullIsEmpty(String str) {
+        return (str == null) ? "" : str;
+    }
 }