]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/utils/Misc.java
variant of isEmptyOrNull for CharSequence
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / utils / Misc.java
index d333d4796c3c5dc85f1756134e8227709c451135..c4dc78750b97d3951c3876c9b901b8b8375151f4 100644 (file)
@@ -62,4 +62,19 @@ public class Misc {
     public static String nullIsEmpty(String str) {
         return (str == null) ? "" : str;
     }
+    public static boolean isEmptyOrNull (String str) {
+        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));
+    }
+    public static boolean isEmptyOrNull(CharSequence text) {
+        if (text == null)
+            return true;
+        return text.length() == 0;
+    }
 }