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

public static String reverseFormatDateEntry(String date) {
    if (date == null || date.isEmpty() || date.equals("0")) {
        return "";
    }//from  ww w.  j av  a  2  s .c  o m

    return date.substring(6, 8) + "/" + date.substring(4, 6) + "/" + date.substring(0, 4);
}

From source file:Main.java

/**
 * Checks if the argument is not null and not empty. If it is, displays an Toast with the message given in parameter
 *
 * @param arg            The string argument to be checked
 * @return True if the argument is correct, false otherwise
 *///from ww w  . ja v  a  2 s  .c o  m
public static boolean checkArguments(String arg) {
    return !(arg == null || arg.isEmpty());
}

From source file:Main.java

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

From source file:Main.java

public static boolean isNicknameValid(String nickname) {
    String trimmed = nickname.trim();
    return !(trimmed.isEmpty() || trimmed.contains(" "));
}

From source file:Main.java

public static boolean shouldBeTranslated(String s) {
    if (s.isEmpty())
        return false;

    if (s.trim().isEmpty())
        return false;

    Matcher matcher = number_pattern.matcher(s);

    if (matcher.matches())
        return false;

    return true;//from   w w w. jav  a  2s. com
}

From source file:Main.java

public static int getCmd(String argument) {
    if (argument.isEmpty())
        return RTL_AIS_ANDROID_CMD_UNKNOWN;
    if (argument.equals(exit_argument))
        return RTL_AIS_ANDROID_CMD_STOP;
    if (argument.equals(status_argument))
        return RTL_AIS_ANDROID_CMD_STATUS;
    return RTL_AIS_ANDROID_CMD_START;

}

From source file:Main.java

public static void printToConsole(String message) {
    if (message.isEmpty() || !DEBUG)
        return;//from   ww w. j a  va  2 s. c om
    int len = 50 - message.length();
    String spacer = "";
    for (int i = 0; i < len / 2; i++) {
        spacer += " ";
    }
    System.out.println("");
    System.out.println("**************************************************");
    System.out.println(spacer + message);
    System.out.println("**************************************************");
    System.out.println("");
}

From source file:Main.java

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

From source file:Main.java

public static String[] parseHSB(String hsv) {
    if (hsv == null || hsv.isEmpty()) {
        return null;
    }/*from w  w  w. java  2  s  . c o  m*/

    String hsvValue[] = new String[3];
    hsvValue = hsv.split(",");

    return hsvValue;
}

From source file:Main.java

public static String Combine(String path1, String path2) {
    if (path2 == null || path2.isEmpty())
        return path1;
    if (path1 == null || path1.isEmpty())
        return path2;
    return new File(path1, path2).getAbsolutePath();
}