From e7cde3553714eb10d2e2df6352334e72c4c7348f Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sun, 5 Apr 2020 23:29:26 +0300 Subject: [PATCH] helper routines for treating "" as null and vice versa --- app/src/main/java/net/ktnx/mobileledger/utils/Misc.java | 6 ++++++ 1 file changed, 6 insertions(+) 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; + } } -- 2.39.5