From a8764e35e1c5e7e40ab73c51e2ac1a7ac7e03b26 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Mon, 20 Apr 2020 21:36:24 +0300 Subject: [PATCH] utility routines for comparing strings with another string/CharSeqence, treating null values as empty strings --- 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 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)); + } } -- 2.39.5