From: Damyan Ivanov Date: Fri, 1 May 2020 14:48:56 +0000 (+0300) Subject: variant of isEmptyOrNull for CharSequence X-Git-Tag: v0.12.0~34 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=d3410680fd511a43a8de6e3060ecce04bb701aca;p=mobile-ledger.git variant of isEmptyOrNull for CharSequence --- 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 caa107c2..c4dc7875 100644 --- a/app/src/main/java/net/ktnx/mobileledger/utils/Misc.java +++ b/app/src/main/java/net/ktnx/mobileledger/utils/Misc.java @@ -72,4 +72,9 @@ public class Misc { public static boolean equalStrings(String a, String b) { return nullIsEmpty(a).equals(nullIsEmpty(b)); } + public static boolean isEmptyOrNull(CharSequence text) { + if (text == null) + return true; + return text.length() == 0; + } }