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:io.fabric8.maven.core.config.BuildRecreateMode.java

public static BuildRecreateMode fromParameter(String param) {
    if (StringUtils.isBlank(param)) {
        return none;
    } else if (param.equalsIgnoreCase("true")) {
        return all;
    }//from  w  w w .  j a v a2 s. co  m
    return valueOf(param.toLowerCase());
}

From source file:Main.java

private static java.util.Date getParsedDate(String type, String parseAs, String value) throws ParseException {

    String format = type;

    if (parseAs != null && parseAs.trim().length() > 0) {
        format = parseAs;/*from w  w  w .j a  v a2s  .  c  o m*/
    }

    if (format.equalsIgnoreCase("date")) {
        return fmtDate.parse(value);
    } else if (format.equalsIgnoreCase("time")) {
        return fmtTime.parse(value);
    } else if (format.equalsIgnoreCase("timestamp")) {
        return fmtTimeStamp.parse(value);
    }

    return null;
}

From source file:Main.java

public static boolean equals(String s1, String s2, boolean ignoreCase) {
    if (s1 != null && s2 != null) {
        if (ignoreCase) {
            return s1.equalsIgnoreCase(s2);
        } else {/*from  w  w w  . j a v a  2 s.com*/
            return s1.equals(s2);
        }
    } else {
        return ((s1 == null && s2 == null) ? true : false);
    }
}

From source file:Main.java

/**
 * Gets text from a spinner, checks if it is valid, trims it, and if it is not = null,
 * returns a boolean of true/ false//from w  w w.j a  va2 s.c  o m
 * @param spinner
 * @return
 */
public static boolean isFieldValid(Spinner spinner) {
    String str = spinner.getSelectedItem().toString();
    if (!str.equals(null)) {
        str = str.trim();
        if (!str.equalsIgnoreCase("")) {
            return true;
        }
    }
    return false;
}

From source file:monasca.common.model.alarm.AlarmSeverity.java

public static AlarmSeverity fromString(String text) {
    if (text != null) {
        for (AlarmSeverity alarmSeverity : AlarmSeverity.values()) {
            if (text.equalsIgnoreCase(alarmSeverity.toString())) {
                return alarmSeverity;
            }/*from   w  w w .ja v  a2 s  .  c  o m*/
        }
    }
    return null;
}

From source file:io.appium.uiautomator2.utils.Attribute.java

@Nullable
public static Attribute fromString(String alias) {
    if (alias == null) {
        return null;
    }/*w w w  .  ja v a  2s . c  om*/

    for (Attribute attribute : Attribute.values()) {
        for (String attrAlias : attribute.aliases) {
            if (attrAlias.equalsIgnoreCase(alias)) {
                return attribute;
            }
        }
    }
    return null;
}

From source file:Main.java

static boolean isPalindrome(String text) {
    System.out.println("Original text = " + text);

    String reverse = new StringBuilder(text).reverse().toString();
    System.out.println("Reverse text  = " + reverse);
    return text.equalsIgnoreCase(reverse);
}

From source file:org.aevans.goat.net.ConnectionUtils.java

public static ConnectionKeepAliveStrategy getConnectionKeepAliveStrategy(final int keepAlive) {
    return new ConnectionKeepAliveStrategy() {

        public long getKeepAliveDuration(HttpResponse response, HttpContext context) {
            // Honor 'keep-alive' header
            HeaderElementIterator it = new BasicHeaderElementIterator(
                    response.headerIterator(HTTP.CONN_KEEP_ALIVE));
            while (it.hasNext()) {
                HeaderElement he = it.nextElement();
                String param = he.getName();
                String value = he.getValue();
                if (value != null && param.equalsIgnoreCase("timeout")) {
                    try {
                        return Long.parseLong(value) * 1000;
                    } catch (NumberFormatException ignore) {
                    }/*  w w  w.ja  v  a 2s  .co  m*/
                }
            }

            return keepAlive * 1000;
        }

    };
}

From source file:dependencies.material_components.utils.JSONUtils.java

public static ArrayMap toArrayMap(JSONObject object) throws JSONException {
    ArrayMap arrayMap = new ArrayMap();
    Iterator<String> keysItr = object.keys();
    while (keysItr.hasNext()) {
        String key = keysItr.next();
        Object valueObject = object.get(key);
        String value = (valueObject instanceof String ? (String) valueObject : String.valueOf(valueObject));
        arrayMap.put(key, value.equalsIgnoreCase("null") ? "" : value);
    }/*ww  w.j ava 2  s  . c  o m*/
    return arrayMap;
}

From source file:Main.java

/**
 * Check if the given array contains the given value (with case-insensitive comparison).
 *
 * @param array The array/*from  w  ww  . ja va  2  s . c o  m*/
 * @param value The value to search
 * @return true if the array contains the value
 */
public static boolean containsIgnoreCase(String[] array, String value) {
    for (String str : array) {
        if (value == null && str == null)
            return true;
        if (value != null && value.equalsIgnoreCase(str))
            return true;
    }
    return false;
}