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 String GetParentPath(String uri) {
    if (uri.equalsIgnoreCase("/")) {
        return "";
    }// w ww .j ava2s . co  m
    if (uri.endsWith("/")) {
        uri = uri.substring(0, uri.length() - 1);
    }
    if (uri.indexOf('/') < 0) {
        return "";
    }

    SimpleStringSplitter sss = new SimpleStringSplitter('/');
    sss.setString(uri);
    String tmp = "";
    String ret = "";
    while (sss.hasNext()) {
        tmp = sss.next();
        if (sss.hasNext() && tmp.trim().length() > 0) {
            ret += tmp.trim() + "/";
        }
    }
    if (ret.endsWith("/")) {
        ret = ret.substring(0, ret.length() - 1);
    }
    return ret;
}

From source file:Main.java

private static char unEscapeString(String str) {
    if (str.equalsIgnoreCase("&lt;"))
        return '<';
    else if (str.equalsIgnoreCase("&gt;"))
        return '>';
    else if (str.equalsIgnoreCase("&amp;"))
        return '&';
    else if (str.equalsIgnoreCase("&quot;"))
        return '\"';
    else if (str.equalsIgnoreCase("&apos;") || str.equalsIgnoreCase("&#39;"))
        return '\'';
    else/*from ww w . j a  v  a  2s  .com*/
        return 0x0;
}

From source file:gt.org.ms.api.requesting.ValidationsHelper.java

public static boolean containsAny(String source, String param) {
    return source.equalsIgnoreCase(param);
}

From source file:Main.java

public static String getExtraInfo(Context context) {
    ConnectivityManager connectivity = (ConnectivityManager) context
            .getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo nwInfo = connectivity.getActiveNetworkInfo();
    if (nwInfo == null) {
        return null;
    }//from  w  ww . j a  v  a  2  s  .  c o  m
    String extraInfo = nwInfo.getExtraInfo();
    String typeName = nwInfo.getTypeName();
    if (typeName != null && typeName.equalsIgnoreCase("WIFI")) {
        return typeName;
    }
    return extraInfo;
}

From source file:Main.java

public static Boolean isNullOrWhitespace(String string) {
    if (string == null)
        return true;

    if (string.equalsIgnoreCase("null"))
        return true;

    String trimed = string.trim();
    return TextUtils.isEmpty(trimed);
}

From source file:Console.java

public static boolean askYorN(String prompt) {
    while (true) {
        String answer;
        System.out.print("\n" + prompt + " (Y or N) ");
        answer = sc.next();// w w w.j  a  va 2s.c  o  m
        if (answer.equalsIgnoreCase("Y"))
            return true;
        else if (answer.equalsIgnoreCase("N"))
            return false;
    }
}

From source file:Main.java

/**
 * judge a image format is gif or not/*  w  w w . j  a  va 2 s  . com*/
 * 
 * @param imageName
 *            image'name
 * @return true is gif format, false isn't gif format
 */
public static boolean isGifFormatImage(String imageName) {
    String string = imageName.substring(imageName.lastIndexOf(".") + 1);
    if (string.equalsIgnoreCase(IMAGE_TYPT_GIF)) {
        return true;
    } else {
        return false;
    }
}

From source file:com.mycompany.mavenproject1.robertclasses.CheckFormat.java

public static boolean isDatabase(String str) {
    boolean isMySql = (str.equalsIgnoreCase("MySql"));
    boolean isOracle = (str.equalsIgnoreCase("Oracle"));
    boolean isValid = (isMySql || isOracle);
    return isValid;
}

From source file:libra.preprocess.Preprocessor.java

private static String[] removeRunStages(String[] args) {
    List<String> param = new ArrayList<String>();
    for (String arg : args) {
        if (!arg.equalsIgnoreCase("stage1") && !arg.equalsIgnoreCase("stage2")) {
            param.add(arg);/*from w  w w .j a v a2  s. com*/
        }
    }

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

From source file:Main.java

/***
 * Case insensitive check if the collection contains the string.
 * @param collectionThe collection of objects, only strings are checked
 * @param match String to match/*from w w w  .ja va 2 s.  c o  m*/
 * @return true, if match contained in the collection
 */
protected static boolean caseInsensitiveContains(ArrayList collection, String match) {
    for (Object obj : collection) {
        String str = (String) obj;
        if (str != null) {
            if (str.equalsIgnoreCase(match)) {
                return true;
            }
        }
    }

    return false;
}