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 isLegalName(String n) {
    if (n.length() == 0)
        return false;
    if (!Character.isLetter(n.charAt(0)))
        return false;
    for (int i = 0; i < n.length(); i++) {
        char c = n.charAt(i);
        if (Character.isLetterOrDigit(c))
            continue;
        if (c == '_')
            continue;
        if (c == '.')
            continue;
        return false;
    }/*  ww w .j a  v  a2 s. c om*/
    if (n.length() > 1) {
        String n2 = n.substring(0, 2);
        if (n2.equalsIgnoreCase("JS"))
            return false;
    }
    if (n.indexOf("__") >= 0)
        return false;
    if (reservedWords.contains(n))
        return false;
    return true;
}

From source file:Main.java

public static void resetUserPassword(String username, String newPassword) {
    try {// www  .  j  a v  a 2s  . co m
        if (!username.equalsIgnoreCase("weblogic")) {
            connection.invoke(defaultAuthenticator, "resetUserPassword", new Object[] { username, newPassword },
                    new String[] { "java.lang.String", "java.lang.String" });
        }
    } catch (InstanceNotFoundException | MBeanException | ReflectionException | IOException e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    }
}

From source file:Main.java

public static List<Map<String, Object>> setFirstMapFromList(List<Map<String, Object>> list, String field,
        String value) {/*from   w  w w.ja  v  a 2  s. c  om*/

    List<Map<String, Object>> collection = new ArrayList<Map<String, Object>>();
    for (Iterator<Map<String, Object>> iter = list.iterator(); iter.hasNext();) {

        Map<String, Object> map = iter.next();
        String deField = map.get(field).toString();
        if (deField.equalsIgnoreCase(value)) {
            collection.add(map);
            collection.addAll(list);

            list.clear();
            list.addAll(collection);
            break;
        }
    }
    return list;
}

From source file:libra.core.Core.java

private static String[] removeRunMode(String[] args) {
    List<String> param = new ArrayList<String>();
    for (String arg : args) {
        if (!arg.equalsIgnoreCase("map") && !arg.equalsIgnoreCase("reduce")) {
            param.add(arg);/*from  w w  w  . ja v  a2  s. c  o  m*/
        }
    }

    return param.toArray(new String[0]);
}

From source file:Main.java

public static boolean containStringInColumn(JTable jTable, int col, String valueBuscado) {

    int num_rows = jTable.getRowCount();
    boolean resp = false;
    //iteramos la tabla
    for (int r = 0; r < num_rows; r++) {
        String valueTabla = "" + jTable.getValueAt(r, col);

        if (valueTabla.equalsIgnoreCase(valueBuscado)) {
            resp = true;/*from  w  w w  . j a  v  a  2s  .  c  o  m*/
            break;
        }
    }

    return resp;
}

From source file:Main.java

public static boolean isZhCN(Context context) {
    String lang = context.getResources().getConfiguration().locale.getCountry();
    return lang.equalsIgnoreCase("CN");
}

From source file:libra.core.Core.java

private static int checkRunMode(String[] args) {
    int runMode = 0;
    for (String arg : args) {
        if (arg.equalsIgnoreCase("map")) {
            runMode = RUN_MODE_MAP;//from  w  w w .  ja v a2  s. c  om
        } else if (arg.equalsIgnoreCase("reduce")) {
            runMode = RUN_MODE_REDUCE;
        }
    }

    return runMode;
}

From source file:Main.java

/**
 * <p>/*from   www .  ja va 2  s  . c om*/
 * Compares two Strings, returning <code>true</code> if they are equal ignoring the case.
 * </p>
 * <p/>
 * <p>
 * <code>Nulls</code> are handled without exceptions. Two <code>null</code> references are considered equal.
 * Comparison is case insensitive.
 * </p>
 *
 * @param str1 the first string
 * @param str2 the second string
 * @return <code>true</code> if the Strings are equal, case insensitive, or both <code>null</code>
 * @see java.lang.String#equalsIgnoreCase(String)
 */
public static boolean equalsIgnoreCase(String str1, String str2) {
    return (str1 == null ? str2 == null : str1.equalsIgnoreCase(str2));
}

From source file:Main.java

public static boolean isEmptyOrNull(String string) {
    if (string == null || string.trim().length() == 0 || string.equalsIgnoreCase("null")) {
        return true;
    } else {/*from   w w w.j ava 2  s  . co m*/
        return false;
    }
}

From source file:Main.java

public static boolean isEqualIgnoreCase(final String s1, final String s2, final String desiredS2ForNull) {
    return s1 != null ? s1.equalsIgnoreCase(s2) : s2.equals(desiredS2ForNull);
}