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 endWithMytext(String mytext, String end) {
    if (TextUtils.isEmpty(mytext) && TextUtils.isEmpty(end))
        return false;
    else {/*from   ww w . j a v a 2s.c  o m*/
        if (mytext.endsWith(end))
            return true;
        else
            return false;
    }
}

From source file:Main.java

public static String getVehicleName(String input) {

    if (TextUtils.isEmpty(input))
        return "";

    char[] c = input.toCharArray();
    for (int i = 0; i < c.length; i++) {
        if (c[i] == 12288) {
            c[i] = (char) 32;
            continue;
        }//  w  ww . j ava2 s .c o m
        if (c[i] > 65280 && c[i] < 65375)
            c[i] = (char) (c[i] - 65248);
    }
    return new String(c);
}

From source file:Main.java

public static String removeHtml(String htmlStr) {
    if (TextUtils.isEmpty(htmlStr)) {
        return "";
    }//from   w w  w  .j  a  va2 s  .  c  om
    String html = htmlStr;
    html = html.replaceAll("<(.*?)\\>", " ");//Removes all items in brackets
    html = html.replaceAll("<(.*?)\\\n", " ");//Must be undeneath
    html = html.replaceFirst("(.*?)\\>", " ");//Removes any connected item to the last bracket
    html = html.replaceAll("&nbsp;", " ");
    html = html.replaceAll("&amp;", "&");
    html = html.replaceAll("&lt;", "<");
    html = html.replaceAll("&gt;", ">");
    html = html.replaceAll("&nbsp;", " ");
    return html;
}

From source file:Main.java

public static boolean isExists(String fileName) {
    if (TextUtils.isEmpty(fileName)) {
        return false;
    }//www. java2  s.co  m
    File file = new File(fileName);
    return file.exists();
}

From source file:Main.java

public static boolean isFileExist(String fileName) {
    if (TextUtils.isEmpty(fileName)) {
        return false;
    }/*w  ww .j  a v a2s.c  o  m*/
    File file = new File(fileName);
    return file.exists();
}

From source file:Main.java

public static String convertToUnquotedString(String string) {
    if (TextUtils.isEmpty(string))
        return "";

    if (!isQuotedString(string))
        return string;

    return string.substring(1, string.length() - 1);
}

From source file:Main.java

public static boolean isJsonNull(String content) {
    if ("null".equals(content) || TextUtils.isEmpty(content)) {
        return true;
    }/*from   w  w w . jav  a 2 s  . co m*/
    return false;
}

From source file:Main.java

public static String decode(String decodecon) {
    if (TextUtils.isEmpty(decodecon)) {
        return "";
    }//www . j  a  va2s .  c  om
    return new String(Base64.decode(decodecon, Base64.DEFAULT));

}

From source file:Main.java

public static String encode(String binaryData) {
    if (TextUtils.isEmpty(binaryData)) {
        return "";
    }//from   w  ww . ja  v  a  2 s .c om
    return new String(Base64.encode(binaryData.getBytes(), Base64.DEFAULT));

}

From source file:Main.java

public static boolean isNull(String str) {
    return TextUtils.isEmpty(str) || "null".equals(str);
}