Example usage for android.text TextUtils isEmpty

List of usage examples for android.text TextUtils isEmpty

Introduction

In this page you can find the example usage for android.text TextUtils isEmpty.

Prototype

public static boolean isEmpty(@Nullable CharSequence str) 

Source Link

Document

Returns true if the string is null or 0-length.

Usage

From source file:Main.java

public static boolean isQuotedString(String string) {
    if (TextUtils.isEmpty(string))
        return false;

    if (string.length() >= 2 && string.charAt(0) == '"' && string.charAt(string.length() - 1) == '"')
        return true;
    return false;
}

From source file:Main.java

private static String getSubdirectory(String resourceId) {
    return TextUtils.isEmpty(resourceId) ? resourceId : String.valueOf(Math.abs(resourceId.hashCode() % 100));
}

From source file:Main.java

public static String preparePathForPicasso(String path) {
    if (TextUtils.isEmpty(path) || path.contains("https://") || path.contains("http://")) {
        return path;
    }//from w w w .ja  v  a2s.  c om
    return path.startsWith("file:") ? path : "file:" + path;
}

From source file:Main.java

public static String getInputIsEmpty(String str) {

    if (TextUtils.isEmpty(str)) {
        return "0";
    } else if (".".equals(str)) {
        return "0";
    } else {/*  www . j a v  a2s.  c  o  m*/
        return str;
    }
}

From source file:Main.java

public static String unquote(String s, String quote) {
    if (!TextUtils.isEmpty(s) && !TextUtils.isEmpty(quote)) {
        if (s.startsWith(quote) && s.endsWith(quote)) {
            return s.substring(1, s.length() - quote.length());
        }/*from w ww  .ja  v a  2 s .  c om*/
    }
    return s;
}

From source file:Main.java

public static boolean isUcos(String cid) {
    ////from   ww w .ja  v a 2s . com
    if (!TextUtils.isEmpty(cid) && cid.length() == 12 && cid.startsWith("6001"))
        return false;

    return !TextUtils.isEmpty(cid) && cid.length() == 12
            && (cid.startsWith("20") || cid.startsWith("21") || cid.startsWith("60") || cid.startsWith("61"));
}

From source file:Main.java

public static boolean isAidExisit(String apdu, String aid) {
    if (TextUtils.isEmpty(apdu) || TextUtils.isEmpty(aid)) {
        return false;
    }/* w  w w .j a v  a2  s.c  o m*/
    return apdu.toLowerCase().contains(aid.toLowerCase());
}

From source file:Main.java

public static String getUriName(String uri) {
    if (!TextUtils.isEmpty(uri)) {
        if (uri.contains("/")) {
            int index = uri.lastIndexOf("/");
            if (index < uri.length() - 2) {
                uri = uri.substring(index + 1, uri.length());
            }/*from   ww w.  j a  v a 2  s .co  m*/
        }
    }
    return uri;
}

From source file:Main.java

public static boolean isEmpty(String email, String password) {
    if (TextUtils.isEmpty(email) || TextUtils.isEmpty(password))
        return true;
    return false;
}

From source file:Main.java

public static boolean isEmpty(String str) {
    if (str == null || TextUtils.isEmpty(str.trim()) || "null".equals(str.trim())) {
        return true;
    }//w  ww  .  j  av  a  2s .c  o m
    return false;
}