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

/**
 * Checks if the given collection of strings contains the provided string ignoring case.
 * <p>/*from w  ww.  j a  v a 2 s . c o  m*/
 * <b>NOTE:</b> for optimal results if possible construct your collection only with lower/upper
 * case strings. It's going to be faster if the checks need to be performed often.
 * 
 * @param collection
 *            the collection to check if contains the given string
 * @param value
 *            the value to check for
 * @return <code>true</code>, if found into the collection ignoring case.
 */
public static boolean containsIgnoreCase(Collection<String> collection, String value) {
    if (value == null) {
        return false;
    }
    for (String string : collection) {
        if (string.equalsIgnoreCase(value)) {
            return true;
        }
    }
    return false;
}

From source file:Main.java

private static int getCompressionType(String header) {
    String s = header.trim();
    if (s.equals("") || s.equalsIgnoreCase(C_HEADER_NONE_VAL))
        return NONE;
    else if (s.equalsIgnoreCase(C_HEADER_GZIP_VAL))
        return GZIP;
    else if (s.equalsIgnoreCase(C_HEADER_ZLIB_VAL))
        return ZLIB;
    else/* ww  w.j ava  2  s. com*/
        return -1;

}

From source file:Main.java

private static Uri getUri() {
    String state = Environment.getExternalStorageState();
    if (!state.equalsIgnoreCase(Environment.MEDIA_MOUNTED))
        return MediaStore.Images.Media.INTERNAL_CONTENT_URI;

    return MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
}

From source file:Main.java

/**
 * //from   w ww  . jav a  2 s. com
 * @param obj
 * @param property
 * @return
 */
public static Object getValue(Object obj, String property) {
    if (property.equalsIgnoreCase("")) {
        return obj;
    }
    String methodName = "get" + Character.toUpperCase(property.charAt(0)) + property.substring(1);
    try {
        if (obj == null)
            return obj;
        Method getterMethod = obj.getClass().getMethod(methodName);
        obj = getterMethod.invoke(obj);
    } catch (Exception e) {
        System.out.println("Error getting property value using getter method " + methodName + " of class "
                + obj.getClass().getName());
    }
    return obj;
}

From source file:Main.java

public static boolean isRtspVideo(Uri uri) {
    if (uri == null) {
        return false;
    }//from ww w. j  a v  a  2  s .c om
    String scheme = uri.getScheme();
    if (scheme != null && scheme.equalsIgnoreCase("rtsp")) {
        return true;
    } else {
        return false;
    }
}

From source file:libra.Libra.java

private static String[] removeRunMode(String[] args) {
    List<String> param = new ArrayList<String>();
    for (String arg : args) {
        if (!arg.equalsIgnoreCase("preprocess") && !arg.equalsIgnoreCase("core")) {
            param.add(arg);/*from www  .  jav a  2 s  .c o m*/
        }
    }

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

From source file:Main.java

public static boolean equalsIgnoreCase(String obj1, String obj2) {
    return obj1 == null ? obj2 == null : obj1.equalsIgnoreCase(obj2);
}

From source file:libra.Libra.java

private static int checkRunMode(String[] args) {
    int runMode = 0;
    for (String arg : args) {
        if (arg.equalsIgnoreCase("preprocess")) {
            runMode = RUN_MODE_PREPROCESS;
        } else if (arg.equalsIgnoreCase("core")) {
            runMode = RUN_MODE_CORE;//from  www .  ja  v  a2s.c om
        }
    }

    return runMode;
}

From source file:Main.java

private static String logicalOpXSLTRepresentation(String logicalop) {
    if (logicalop != null) {
        if (logicalop.equalsIgnoreCase("AND")) {
            return "and";
        } else if (logicalop.equalsIgnoreCase("OR")) {
            return "or";
        }//from  w  w w .  j a  va  2  s.c  om
    }

    return "and";
}

From source file:Main.java

/**
 * @param n Node to look under/*from  w  ww  .j a va 2s  .  c o m*/
 * @return true if the given node contains any #text children
 */
public static boolean isTextNode(Node n) {
    for (Node ele = n.getFirstChild(); ele != null; ele = ele.getNextSibling()) {
        String name = ele.getNodeName();
        if (!name.equalsIgnoreCase("#text")) {
            return false;
        }
    }
    return true;
}