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 buildWinnerString(String awardee, String team) {
    if (awardee.isEmpty()) {
        return "" + team;
    } else if (team.isEmpty()) {
        return awardee;
    } else {// ww  w. j  ava2  s  . c  o m
        return awardee + " (" + team + ")";
    }
}

From source file:Main.java

public static Boolean checkString(String value) {
    if (!(value != null && !value.isEmpty())) {
        return true;
    } else {//from  www  . ja va  2 s .c  o m
        return false;
    }
}

From source file:Main.java

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

From source file:Main.java

public static boolean isNullOrWhiteSpace(String str) {
    if (str == null || str.isEmpty()) {
        return true;
    }/*from w ww. j av  a  2s. com*/
    for (char c : str.toCharArray()) {
        if (!Character.isWhitespace(c)) {
            return false;
        }
    }
    return true;
}

From source file:Main.java

public static String serializeQName(QName qname) {
    String prefix = qname.getPrefix();
    if (prefix.isEmpty()) {
        return qname.getLocalPart();
    }//from   w  ww. j a v  a 2 s.  com
    return prefix + ":" + qname.getLocalPart();
}

From source file:Main.java

/**
 * Returns true if the specified attribute has no string.
 * /*  w w  w . j av a2 s.c  om*/
 * @param nodes
 * @return
 * @throws AnalysisEngineProcessException
 */
public static boolean hasNoAttribute(String attr) {
    if (attr == null || attr.isEmpty()) {
        return true;
    }

    return false;
}

From source file:Main.java

public static String middle(String input, int index, int count) {
    if (input.isEmpty()) {
        return "";
    }/*from   w w w  .  j a v  a  2  s  .c  om*/
    count = (count > input.length() - index + 1) ? input.length() - index + 1 : count;
    return input.substring(index - 1, index + count - 1);
}

From source file:Main.java

License:asdf

public static List<String> allPermutation(String permutation, String letters) {
    List<String> list = new ArrayList<>();
    if (letters.isEmpty()) {
        list.add(permutation);//from  w w  w.j  a v a2 s.  c om
        return list;
    }

    for (int i = 0; i < letters.length(); i++) {
        list.addAll(allPermutation(permutation + letters.charAt(i), removeCharAt(i, letters)));
    }

    return list;
}

From source file:Main.java

public static boolean isEmptyString(String inputString) {
    return inputString == null || inputString.isEmpty();
}

From source file:Main.java

private static String capitalize(String original) {
    if (original.isEmpty()) {
        return original;
    }/*from w w  w. ja  va2  s.c  om*/
    StringBuilder sb = new StringBuilder();
    sb.append(original.substring(0, 1).toUpperCase());
    sb.append(original.substring(1));
    return sb.toString();
}