Example usage for java.lang String equalsIgnoreCase

List of usage examples for java.lang String equalsIgnoreCase

Introduction

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

Prototype

public boolean equalsIgnoreCase(String anotherString) 

Source Link

Document

Compares this String to another String , ignoring case considerations.

Usage

From source file:Main.java

public static boolean getBooleanAttr(Element element, String name) {
    String attr = element.getAttribute(name);
    boolean ret = attr.equalsIgnoreCase("true");
    return ret;/*  ww w .  j av  a2  s  . com*/
}

From source file:Main.java

public static boolean readBoolean(StringReader reader, char delimiter) {
    String bool = readString(reader, delimiter);
    return bool.equalsIgnoreCase("Y") || bool.equalsIgnoreCase("true");
}

From source file:Main.java

private static boolean isVideo(String ext) {
    for (String s : VIDEO_EXTENSIONS) {
        if (s.equalsIgnoreCase(ext))
            return true;
    }/* w  w  w .j ava  2  s .c om*/
    return false;
}

From source file:Main.java

/**
 * return if str is empty// w  w  w.j  a v a 2 s .c om
 *
 * @param str
 * @return
 */
public static boolean isEmpty(String str) {
    return str == null || str.length() == 0 || str.equalsIgnoreCase("null") || str.isEmpty() || str.equals("");
}

From source file:Main.java

public static boolean hasValue(Map<?, ?> map, String key, String val) {
    if (map == null) {
        return false;
    }/*from   w w  w  .j a v a  2 s  .c om*/
    Collection<?> col = (Collection<?>) map.get(key);
    if (col == null) {
        return false;
    }
    Iterator<?> itr = col.iterator();
    while (itr.hasNext()) {
        String str = (String) itr.next();
        if (str.equalsIgnoreCase(val)) {
            return true;
        }
        if (str.toLowerCase().startsWith(val)) {
            return true;
        }
    }
    return false;
}

From source file:Main.java

@SuppressWarnings("ResourceType")
@SuppressLint("ShowToast")
public static void showToastMessage(Context context, String msg) {

    try {//from  w ww .  j a v a  2  s.  c o  m
        if (msg != null && !msg.equalsIgnoreCase("")) {
            Toast.makeText(context.getApplicationContext(), msg, 4000).show();
        }
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

From source file:Main.java

/**
 * @param n the node to look for text on
 * @return The conjoined values of all #text nodes immediately under this
 * node/*w  w  w .  j a  va 2  s. c om*/
 */
public static String getText(Node n) {
    StringBuilder sb = new StringBuilder();
    for (Node ele = n.getFirstChild(); ele != null; ele = ele.getNextSibling()) {
        String name = ele.getNodeName();
        if (name.equalsIgnoreCase("#text")) {
            sb.append(ele.getNodeValue());
        }
    }
    return sb.toString().trim();
}

From source file:Main.java

/**
 * return if str is empty/*from w  w w .  j ava2  s. c o m*/
 *
 * @param str
 * @return
 */
public static boolean isEmpty(String str) {
    if (str == null || str.length() == 0 || str.equalsIgnoreCase("null") || str.isEmpty() || str.equals("")) {
        return true;
    } else {
        return false;
    }
}

From source file:Main.java

private static String relationalOpXSLTRepresentation(String relationalop) {
    if (relationalop != null) {
        if (relationalop.equalsIgnoreCase("EQ")) {
            return "=";
        } else if (relationalop.equalsIgnoreCase("NEQ")) {
            return "!=";
        }//from   w ww .ja  va2s .co m
    }

    return "=";
}

From source file:Main.java

public static boolean isContainText(String search, String originalText) {
    if (search != null && !search.equalsIgnoreCase("")) {
        String normalizedText = Normalizer.normalize(originalText, Normalizer.Form.NFD)
                .replaceAll("\\p{InCombiningDiacriticalMarks}+", "").toLowerCase();
        int start = normalizedText.indexOf(search);
        if (start < 0) {
            return false;
        } else {/*from w w  w . ja va 2 s  .  com*/
            return true;
        }
    }
    return false;
}