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 String nullsafeTrim(String str) {
    return TextUtils.isEmpty(str) ? str : str.trim();
}

From source file:Main.java

public static boolean isMucId(String mucId) {
    return !TextUtils.isEmpty(mucId) && mucId.endsWith(".muc");
}

From source file:Main.java

public static boolean stringisEmpty(String str) {
    return TextUtils.isEmpty(str.trim());
}

From source file:Main.java

public static String getStringNotNull(String str) {
    return TextUtils.isEmpty(str) ? "" : str;
}

From source file:Main.java

public static boolean isEmpty(String s) {

    if (TextUtils.isEmpty(s))
        return true;

    else//  w w  w  . ja  v  a2 s  .  c o  m
        return false;
}

From source file:Main.java

private static boolean isLocalPath(String path) {
    return !TextUtils.isEmpty(path) && !path.startsWith("http");
}

From source file:Main.java

public static String prependProtocol(String s) {
    if (!TextUtils.isEmpty(s) && !s.startsWith("http:") && !s.startsWith("https:"))
        s = (new StringBuilder("https:")).append(s).toString();
    return s;/* ww  w.  j a v a 2s.  c o m*/
}

From source file:Main.java

public static String c2f(String celsius) {
    if (!TextUtils.isEmpty(celsius)) {
        int fahrenheit = (int) (Float.parseFloat(celsius) * 9 / 5 + 32);
        return fahrenheit + "";
    } else {//  www  .  ja v a  2s  .  c om
        return "";
    }
}

From source file:Main.java

public static String filterNum(String text) {
    if (TextUtils.isEmpty(text))
        return "";

    return text.replaceAll("[^0-9]", "");
}

From source file:Main.java

public static boolean isEmptyText(String txt) {
    if (TextUtils.isEmpty(txt))
        return true;
    else//from  w  w  w  . j ava  2 s.c  o  m
        return false;
}