From: Damyan Ivanov Date: Mon, 20 Apr 2020 18:36:24 +0000 (+0300) Subject: utility routines for comparing strings with another string/CharSeqence, treating... X-Git-Tag: v0.12.0~46 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=a8764e35e1c5e7e40ab73c51e2ac1a7ac7e03b26;p=mobile-ledger.git utility routines for comparing strings with another string/CharSeqence, treating null values as empty strings --- 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 4443f230..caa107c2 100644 --- a/app/src/main/java/net/ktnx/mobileledger/utils/Misc.java +++ b/app/src/main/java/net/ktnx/mobileledger/utils/Misc.java @@ -66,4 +66,10 @@ public class Misc { if (str == null) return true; return str.isEmpty(); } + public static boolean equalStrings(String u, CharSequence text) { + return nullIsEmpty(u).equals(text.toString()); + } + public static boolean equalStrings(String a, String b) { + return nullIsEmpty(a).equals(nullIsEmpty(b)); + } }