From: Damyan Ivanov Date: Sun, 5 Apr 2020 20:29:26 +0000 (+0300) Subject: helper routines for treating "" as null and vice versa X-Git-Tag: v0.12.0~64 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=e7cde3553714eb10d2e2df6352334e72c4c7348f;p=mobile-ledger.git helper routines for treating "" as null and vice versa --- diff --git a/app/src/main/java/net/ktnx/mobileledger/utils/Misc.java b/app/src/main/java/net/ktnx/mobileledger/utils/Misc.java index 9e0a3fec..d333d479 100644 --- a/app/src/main/java/net/ktnx/mobileledger/utils/Misc.java +++ b/app/src/main/java/net/ktnx/mobileledger/utils/Misc.java @@ -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; + } }