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 isMainProcess(Context context) {
    String packageName = context.getPackageName();
    String processName = getCurProcessName(context);
    return packageName.equalsIgnoreCase(processName);
}

From source file:Main.java

public static boolean isEquals(String... agrs) {
    String last = null;/*w w  w  . j  a va2 s. c om*/
    for (int i = 0; i < agrs.length; i++) {
        String str = agrs[i];
        if (isEmpty(str)) {
            return false;
        }
        if (last != null && !str.equalsIgnoreCase(last)) {
            return false;
        }
        last = str;
    }
    return true;
}

From source file:com.neophob.sematrix.gui.GuiElement.java

/**
 * /*from  www.  java2  s . co m*/
 * @param s
 * @return
 */
public static GuiElement getGuiElement(String s) {
    for (GuiElement gw : GuiElement.values()) {
        if (s.equalsIgnoreCase(gw.toString()) || s.equalsIgnoreCase(gw.guiText())) {
            return gw;
        }
    }
    return null;
}

From source file:com.funzio.pure2D.particles.nova.vo.MotionTrailVO.java

public static MotionTrailVO create(final JSONObject json) throws JSONException {
    if (!json.has("type")) {
        return null;
    }//from   w  w w . j av a 2s . c o  m

    final String type = json.getString("type");

    if (type.equalsIgnoreCase(SHAPE)) {
        return new MotionTrailShapeVO(json);
    } else {
        return null;
    }
}

From source file:Main.java

public static String getPersonNameFromNumber(Context context, String box, String address) {
    if (address == null) {
        return "unknown";
    }/*from   w  ww  .  ja  v  a 2  s  .c  o  m*/
    if (!box.equalsIgnoreCase("draft")) {
        Cursor cursor = context.getContentResolver().query(
                Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(address)),
                new String[] { PhoneLookup.DISPLAY_NAME }, null, null, null);
        if (cursor != null) {
            try {
                if (cursor.getCount() > 0) {
                    cursor.moveToFirst();
                    String name = cursor.getString(0);
                    return name;
                }
            } finally {
                cursor.close();
            }
        }
    }
    if (address != null) {
        return PhoneNumberUtils.formatNumber(address);
    }
    return "unknown";
}

From source file:Main.java

/**
 * Gets text from an editText, 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 v  a 2 s .  com
 * @param et
 * @return
 */
public static boolean isFieldValid(EditText et) {
    String str = et.getText().toString();
    if (!str.equals(null)) {
        str = str.trim();
        if (!str.equalsIgnoreCase("")) {
            if (!str.isEmpty()) {
                return true;
            }
        }
    }
    return false;
}

From source file:Main.java

public static Map<String, String> paraFilter(Map<String, String> para) {

    Map<String, String> result = new HashMap<String, String>();

    if (para == null || para.size() <= 0) {
        return result;
    }//from  w w  w . j ava2  s .c om

    for (String key : para.keySet()) {
        String value = para.get(key);
        if (value == null || value.equals("") || key.equalsIgnoreCase(SIGNATURE)
                || key.equalsIgnoreCase(SIGN_METHOD)) {
            continue;
        }
        result.put(key, value);
    }

    return result;
}

From source file:edu.dfci.cccb.mev.hcl.domain.contract.Metric.java

public static Metric from(String string) throws InvalidMetricException {
    for (Metric metric : values())
        for (String alias : metric.aliases)
            if (alias.equalsIgnoreCase(string))
                return metric;
    throw new InvalidMetricException().name(string);
}

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

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

From source file:Main.java

public static boolean checkSignature(Context ctx, String packageName, String srcSignature) {

    PackageManager pm = ctx.getPackageManager();
    try {/*from  www . j  a v a 2s. c o m*/
        PackageInfo pack = pm.getPackageInfo(packageName, PackageManager.GET_SIGNATURES);
        Signature[] signatures = pack.signatures;
        String destSignature = getApkSignatureMD5String(signatures[0]);
        return destSignature.equalsIgnoreCase(srcSignature);
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }
    return false;
}