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 long mGetLongValueOf(String pVal) {
    if (pVal == null || pVal.isEmpty())
        return 0;
    return Long.valueOf(pVal);
}

From source file:Main.java

public static final boolean emptyOrNull(final String s) {
    return (s == null) || s.isEmpty();
}

From source file:Main.java

private static boolean isValidRegex(String regex) {
    return regex != null && !regex.isEmpty() && regex.length() > 2;
}

From source file:Main.java

public static String ChangeDateDotNetFormat(String date) {
    if (date.isEmpty()) {
        return "";
    }/* ww w .  j  a va 2 s . c  o m*/
    try {

        Date dt = new SimpleDateFormat("yyyy-MM-dd kk:mm:ss").parse(date.replace("T", " "));
        return new SimpleDateFormat("dd/MM/yyyy").format(dt);
    } catch (Exception ex) {
        return date;
    }
}

From source file:Main.java

public static boolean isNullOrEmpty(String string) {
    return string == null || string.isEmpty();
}

From source file:Main.java

public static boolean checkValidString(String string) {
    return string != null && !string.isEmpty() && !string.equals("null");
}

From source file:Main.java

/**
 * Check wether the given string is null or empty
 * @param str the string to check// www . j a va 2 s  .  c  o m
 * @return true if string was null or empty
 */
public static boolean isNullOrEmpty(String str) {
    return str == null || str.isEmpty();
}

From source file:Main.java

public static int getInt(String str) {
    if (str == null || str.isEmpty() || str.equals("0"))
        return 0;

    int value = Integer.parseInt(str);

    return value;
}

From source file:Main.java

public static boolean isNullEmptyOrWhitespace(String value) {
    return value == null || value.isEmpty() || value.trim().isEmpty();
}

From source file:Main.java

public static void showToast(Context context, String text) {
    if (null != text && !text.isEmpty())
        Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
}