]> git.ktnx.net Git - mobile-ledger-staging.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/utils/Misc.java
replace local utility functions with ones from TextUtils
[mobile-ledger-staging.git] / app / src / main / java / net / ktnx / mobileledger / utils / Misc.java
index c4dc78750b97d3951c3876c9b901b8b8375151f4..a79bcf93abee7c4845ea2c288a43d3e983ca9b19 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2019 Damyan Ivanov.
+ * Copyright © 2020 Damyan Ivanov.
  * This file is part of MoLe.
  * MoLe is free software: you can distribute it and/or modify it
  * under the term of the GNU General Public License as published by
@@ -21,6 +21,7 @@ import android.app.Activity;
 import android.content.res.Configuration;
 import android.view.WindowManager;
 
+import androidx.annotation.Nullable;
 import androidx.fragment.app.Fragment;
 import androidx.fragment.app.FragmentActivity;
 
@@ -62,19 +63,16 @@ 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;
+    public static String trim(@Nullable String string) {
+        if (string == null)
+            return null;
+
+        return string.trim();
     }
 }