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 isPropertyShortcutMethodEqual(String methodName, String variableName) {

    for (String shortcut : propertyShortcuts) {
        if (methodName.equalsIgnoreCase(shortcut + variableName)) {
            return true;
        }/*w w w. jav a 2 s  .  c  om*/
    }

    return false;
}

From source file:Main.java

/**
 * Parses a String boolean to a Boolean Object
 * /*from   w  w  w  .j a va  2s  .  co  m*/
 * @param bool String boolean to parse
 * @param defaultValue Default Boolean if parsing fails
 * @return A parsed Boolean
 */
public static boolean parseBool(String bool, boolean defaultValue) {
    if (bool == null)
        return defaultValue;
    if (bool.equalsIgnoreCase("on") || bool.equalsIgnoreCase("true") || bool.equalsIgnoreCase("yes"))
        return true;
    if (bool.equalsIgnoreCase("off") || bool.equalsIgnoreCase("false") || bool.equalsIgnoreCase("no"))
        return false;
    return defaultValue;
}

From source file:com.goncalomb.bukkit.bkglib.namemaps.EntityTypeMap.java

public static EntityType getByName(String name) {
    if (name.equalsIgnoreCase("ThrownPotion")) {
        return EntityType.SPLASH_POTION;
    } else if (name.equalsIgnoreCase("MinecartSpawner")) {
        return EntityType.MINECART_MOB_SPAWNER;
    } else {/*from  w w  w .j a va 2s .co  m*/
        return EntityType.fromName(name);
    }
}

From source file:eumetsat.pn.common.util.MimeUtil.java

/**
 * Get Mime type from a Filename/*  w w  w . j  av  a 2 s  . c o m*/
 *
 * @param aFilename
 * @return Mime type as a String
 */
static final public String getMimeType(String aFilename) {
    String mime;

    if (aFilename == null) {
        throw new IllegalArgumentException("aFilename is null");
    }

    String extension = FilenameUtils.getExtension(aFilename);
    if (extension.equalsIgnoreCase("css")) {
        mime = "text/css";
    } else if (extension.equalsIgnoreCase("js")) {
        mime = "text/javascript";
    } else if (extension.equalsIgnoreCase("ico")) {
        mime = "image/x-icon";
    } else if (extension.equalsIgnoreCase(".svg")) {
        mime = "image/svg+xml";
    } else {
        mime = "application/octet-stream";
    }

    return mime;
}

From source file:Main.java

public static boolean isImageExtension(String extension) {
    String[] valid = { ".jpg", ".jpeg" };
    for (String ex : valid) {
        if (extension.equalsIgnoreCase(ex)) {
            return true;
        }//from   w  w  w  .  j av  a  2  s. co  m
    }
    return false;
}

From source file:Main.java

private static String renderEmail(String bodyHtml) {
    StringBuffer bodyStringBuffer = new StringBuffer();

    Matcher matcherEmailContent = patternTagTitle.matcher(bodyHtml);
    while (matcherEmailContent.find()) {

        String processContent = matcherEmailContent.group(1);
        String htmlContent = matcherEmailContent.group(2);

        if (htmlContent.equalsIgnoreCase("</script>") || htmlContent.equalsIgnoreCase("</a>")) {
            matcherEmailContent.appendReplacement(bodyStringBuffer, processContent + htmlContent);
        } else {//from  w ww . j  a  v a2s . c  o  m
            String emailContentHasProcessed = makeEmailHerf(processContent);
            matcherEmailContent.appendReplacement(bodyStringBuffer, emailContentHasProcessed + htmlContent);
        }

    }
    matcherEmailContent.appendTail(bodyStringBuffer);
    return bodyStringBuffer.toString();
}

From source file:Main.java

public static String findXslHref(Node node) {
    int type = node.getNodeType();

    if (type == Node.PROCESSING_INSTRUCTION_NODE) {
        String nodeName = node.getNodeName();
        if (nodeName.equalsIgnoreCase("xml-stylesheet")) {
            String nodeValue = node.getNodeValue();
            try {
                int i = nodeValue.indexOf("href=\"");
                int j = nodeValue.indexOf("\"", i + 6);
                String result = nodeValue.substring(i + 6, j);
                return result;
            } catch (StringIndexOutOfBoundsException e) {
                return null;
            }// w  ww  . j av  a 2s.c o m
        }
        return null;
    } else {
        NodeList children = node.getChildNodes();
        int len = children.getLength();
        for (int i = 0; i < len; i++) {
            String result = findXslHref(children.item(i));
            if (result != null)
                return result;
        }
    }
    return null;
}

From source file:net.landora.video.properties.Languages.java

public static String lookup(String langCode) {
    if (langCode.equalsIgnoreCase("und")) {
        return "";
    }//from ww  w. j a  v  a2  s  . c om

    return langMap.get(langCode);
}

From source file:Main.java

public static boolean isNullOrEmpty(String value) {
    boolean v = true;
    if (value != null && value.trim().equals("") == false && value.equalsIgnoreCase("null") == false) {
        v = false;/*from   w  w w .ja v a2 s  .  c o  m*/
    }
    return v;
}

From source file:org.shept.util.StringUtilsExtended.java

public static boolean equalsIgnoreNullsAndCase(String s1, String s2) {
    if (hasText(s1) && hasText(s2)) {
        return s1.equalsIgnoreCase(s2);
    }//from   w w  w.j a  v a 2 s .co m
    return (!(hasText(s1) || hasText(s2)));
}