Example usage for java.lang String isEmpty

List of usage examples for java.lang String isEmpty

Introduction

In this page you can find the example usage for java.lang String isEmpty.

Prototype

public boolean isEmpty() 

Source Link

Document

Returns true if, and only if, #length() is 0 .

Usage

From source file:Main.java

protected static String mGetStringValueOf(String pVal, String pDefault) {
    if (pVal == null || pVal.isEmpty())
        return pDefault;
    return pVal;//from   w  ww  . ja  v a  2s .c om
}

From source file:Main.java

public static boolean isNotNullOrEmpty(String str) {
    return (str != null) && !str.isEmpty();
}

From source file:Main.java

public static String padString(String str) {
    if (str == null || str.isEmpty()) {
        return "0";
    } else if (str.equals(".")) {
        return "0.";
    } else {//w w  w .ja v  a  2  s. c o  m
        try {
            return String.format(Locale.ENGLISH, "%.4f", Double.parseDouble(str));
        } catch (Exception e) {
            return null;
        }
    }
}

From source file:Main.java

protected static int mGetIntValueOf(String pVal, int pDefault) {
    if (pVal == null || pVal.isEmpty())
        return pDefault;
    return (int) Integer.valueOf(pVal);
}

From source file:Main.java

protected static boolean mGetBooleanValueOf(String pVal, boolean pDefault) {
    if (pVal == null || pVal.isEmpty())
        return pDefault;
    return Boolean.valueOf(pVal);
}

From source file:Main.java

public static void openURL(String url) {
    if (url.isEmpty())
        return;//from  w  ww.j a va 2 s . c om
    Uri uri = Uri.parse(url);
    Intent it = new Intent(Intent.ACTION_VIEW, uri);
    mContext.startActivity(it);
}

From source file:Main.java

public static boolean isEmpty(String str) {
    if (str == null || str.isEmpty()) {
        return true;
    }/*from  w ww  . j  ava2s . c om*/
    return false;
}

From source file:Main.java

public static Boolean validateString(String object) {
    if (object == null || object.isEmpty() || object == "") {
        return false;
    } else {//from  w w w . java  2s .  co m
        return true;
    }
}

From source file:Main.java

private static void maybeAppend(StringBuilder output, String prefix, String value) {
    if (value != null && !value.isEmpty()) {
        output.append(prefix).append(value).append(';');
    }//from  www . j  a v  a 2  s . c  o  m
}

From source file:Main.java

public static boolean isEmptyOrNull(String text) {
    return (text == null) || text.isEmpty();
}