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

private static boolean equalsIgnoreCase(String s1, String s2) {
    if (s1 == s2) {
        return true;
    }//  ww  w  .  j  a  v a 2s .  c om
    if (s1 == null) {
        return false;
    }
    if (s1.equalsIgnoreCase(s2)) {
        return true;
    }
    return false;
}

From source file:edu.northwestern.bioinformatics.studycalendar.domain.ScheduledActivityMode.java

public static ScheduledActivityMode getByName(String name) {
    for (ScheduledActivityMode mode : values()) {
        if (name.equalsIgnoreCase(mode.getName())) {
            return mode;
        }/*from ww w. j  a va  2 s.c o  m*/
    }
    return null;
}

From source file:Main.java

public static String readSubNodeValue(Node n, String name, String dflt) {
    if (name == null)
        return dflt;

    for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
        if (name.equalsIgnoreCase(d.getNodeName()))
            return d.getNodeValue();

    return dflt;//from  w  w  w.ja v a  2s.  co  m
}

From source file:Main.java

public final static boolean equalsIgnoreCase(String str1, String str2) {
    if (str1 == str2) {
        return true;
    }//from w  w  w . j a  v a 2s .  c  o m

    if (str1 == null) {
        return false;
    }

    return str1.equalsIgnoreCase(str2);
}

From source file:Main.java

public static boolean compareUrl(String ur1, String ur2) {
    String[] s = ur1.split("//");
    String[] s1 = ur2.split("/");
    ur1 = s[s.length - 1];/*from w  w  w.  ja  v a2s . c  o  m*/
    ur2 = s1[s1.length - 1];
    return ur1.equalsIgnoreCase(ur2);
}

From source file:Main.java

/**
 * Returns the name of the vendor-specific character set
 * corresponding to the given original character set name and
 * vendor. If there is no vendor-specific character set for the
 * given name/vendor pair, this returns the original character set
 * name. The vendor name is matched case-insensitively.
 * /* ww  w  .  j  a  v a2  s .co  m*/
 * @param charsetName the base character set name
 * @param vendor the vendor to specialize for
 * @return the specialized character set name, or {@code charsetName} if
 * there is no specialized name
 */
public static String nameForVendor(String charsetName, String vendor) {
    // TODO: Eventually, this may want to be table-driven.

    if (vendor.equalsIgnoreCase(VENDOR_DOCOMO) && isShiftJis(charsetName)) {
        return "docomo-shift_jis-2007";
    }

    return charsetName;
}

From source file:Main.java

public static boolean isVivaLastSentenceSame(Context context, String vivaLastSentence) {
    String lastSentence = getVivaLastSentence(context);
    if (!TextUtils.isEmpty(lastSentence)) {
        if (vivaLastSentence.equalsIgnoreCase(lastSentence)) {
            return true;
        } else {//from  w  ww .j av a2 s.  c  o  m
            return false;
        }
    } else {
        return false;
    }
}

From source file:com.adaptris.util.SimpleBeanUtil.java

private static Method getSetterMethod(Class c, String methodName) {
    Method result = null;//from w ww .j a  v  a2  s.  com
    Method[] methods = c.getMethods();
    for (Method m : methods) {
        String name = m.getName();
        if (name.equalsIgnoreCase(methodName)) {
            Class[] params = m.getParameterTypes();
            if (params.length == 1 && PRIMITIVES.contains(params[0])) {
                result = m;
                break;
            }
        }
    }
    return result;
}

From source file:Main.java

/** Returns the tone type that the string character represents. If input is
 * empty, then returns -1. *//*from  w  ww. jav a2  s  .c  om*/
public static int getToneTypeFromString(String toneString) {
    if (TextUtils.isEmpty(toneString)) {
        return -1;
    }

    if (toneString.equalsIgnoreCase("0")) {
        return ToneGenerator.TONE_DTMF_0;
    } else if (toneString.equalsIgnoreCase("1")) {
        return ToneGenerator.TONE_DTMF_1;
    } else if (toneString.equalsIgnoreCase("2")) {
        return ToneGenerator.TONE_DTMF_2;
    } else if (toneString.equalsIgnoreCase("3")) {
        return ToneGenerator.TONE_DTMF_3;
    } else if (toneString.equalsIgnoreCase("4")) {
        return ToneGenerator.TONE_DTMF_4;
    } else if (toneString.equalsIgnoreCase("5")) {
        return ToneGenerator.TONE_DTMF_5;
    } else if (toneString.equalsIgnoreCase("6")) {
        return ToneGenerator.TONE_DTMF_6;
    } else if (toneString.equalsIgnoreCase("7")) {
        return ToneGenerator.TONE_DTMF_7;
    } else if (toneString.equalsIgnoreCase("8")) {
        return ToneGenerator.TONE_DTMF_8;
    } else if (toneString.equalsIgnoreCase("9")) {
        return ToneGenerator.TONE_DTMF_9;
    } else if (toneString.equalsIgnoreCase("A")) {
        return ToneGenerator.TONE_DTMF_A;
    } else if (toneString.equalsIgnoreCase("B")) {
        return ToneGenerator.TONE_DTMF_B;
    } else if (toneString.equalsIgnoreCase("C")) {
        return ToneGenerator.TONE_DTMF_C;
    } else if (toneString.equalsIgnoreCase("D")) {
        return ToneGenerator.TONE_DTMF_D;
    } else if (toneString.equalsIgnoreCase("#")) {
        return ToneGenerator.TONE_DTMF_P;
    } else if (toneString.equalsIgnoreCase("*")) {
        return ToneGenerator.TONE_DTMF_S;
    }
    return ToneGenerator.TONE_DTMF_0; // Error if code reaches here.
}

From source file:com.ewcms.common.io.HtmlFileUtil.java

public static String readText(InputStream is, String encoding) {
    try {//  www . j ava  2  s.c  om
        byte bs[] = readByte(is);
        if (encoding.equalsIgnoreCase("UTF-8")
                && HtmlStringUtil.hexEncode(ArrayUtils.subarray(bs, 0, 3)).equals("efbbbf"))
            bs = ArrayUtils.subarray(bs, 3, bs.length);
        return new String(bs, encoding);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}