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:de.knowwe.core.user.UserContextUtil.java

/**
 * Remove this ugly hack as soon as a proper solution for the double
 * encoding problem is found!//  w  w  w.  j  av  a 2s .  c  o m
 */
private static boolean checkForFlowChart(String parameter) {
    return (parameter != null && !parameter.equalsIgnoreCase("SaveFlowchartAction"));
}

From source file:Main.java

/**
 * Return true if an element/attribute name is a valid NCName (Non Colon Name).
 * //from  w w  w.  j  a  v a2 s. c o m
 * @param name Non-qualified (no colon) name for an element/attribute.
 * @return True if an element/attribute name is a valid NCName.
 */
public static boolean isValidNCName(String name) {
    if (name == null || name.length() <= 0)
        return false;
    if (name.equalsIgnoreCase("XML"))
        return false;
    char c = name.charAt(0);
    if (!Character.isLetter(c) && c != '_')
        return false;
    for (int i = 1; i < name.length(); i++) {
        c = name.charAt(i);
        if (!Character.isLetter(c) && !Character.isDigit(c) && c != '_' && c != '.' && c != '-')
            return false;
    }
    return true;
}

From source file:irille.pub.verify.RandomImageServlet.java

public static String getHeader(HttpServletRequest req, String name) {
    String value = req.getHeader(name);
    if (value != null)
        return value;
    Enumeration names = req.getHeaderNames();
    while (names.hasMoreElements()) {
        String n = (String) names.nextElement();
        if (n.equalsIgnoreCase(name)) {
            return req.getHeader(n);
        }/*from  w  w  w  . j  a  v a  2  s  .c o  m*/
    }
    return null;
}

From source file:Main.java

static void setSwingLAF(java.awt.Component comp, String targetTheme) {

    try {/*from   w ww  .ja v a 2 s. c  om*/
        if (targetTheme.equalsIgnoreCase(Native)) {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } else if (targetTheme.equalsIgnoreCase(Java)) {
            UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
        } else if (targetTheme.equalsIgnoreCase(Motif)) {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
        }

        //            if (targetTheme.equalsIgnoreCase(plaf)){
        //                UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
        //            }
        //
        //            if (targetTheme.equalsIgnoreCase(GTK)){
        //                UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
        //            }
        SwingUtilities.updateComponentTreeUI(comp);

        if (comp instanceof java.awt.Frame) {
            ((java.awt.Frame) comp).pack();
        }
    } catch (Exception e) {
        errorMessage(e);
    }
}

From source file:Main.java

public static String getPollutantTypeByWebHtml(String htmlText) {
    if (htmlText == null)
        return "";
    String type = "";
    if (htmlText.equalsIgnoreCase("PM<sub>2.5</sub>")) {
        type = "PM2.5";
    } else if (htmlText.equalsIgnoreCase("PM<sub>10</sub>")) {
        type = "PM10";
    } else if (htmlText.equalsIgnoreCase("NO<sub>2</sub>")) {
        type = "NO2";
    } else if (htmlText.equalsIgnoreCase("O<sub>3</sub>")) {
        type = "O3";
    } else if (htmlText.equalsIgnoreCase("SO<sub>2</sub>")) {
        type = "SO2";
    } else if (htmlText.equalsIgnoreCase("CO")) {
        type = "CO";
    }/*from   ww  w .  j  ava  2  s . c om*/

    return type;

}

From source file:Main.java

public static String getAndroidId(Context ctx) {
    String androidId = Settings.Secure.getString(ctx.getContentResolver(), Settings.Secure.ANDROID_ID);
    if (androidId == null || androidId.equalsIgnoreCase("android_id")
            || androidId.equalsIgnoreCase("9774d56d682e549c")) {
        return null;
    }//from w ww  . j ava2  s.  com
    return androidId;
}

From source file:com.atomiton.watermanagement.ngo.util.WaterMgmtNGOUtility.java

public static String getXMLElementValue(String tagName, String xmlString) {
    try {//from   w w w .  ja v a  2 s . c om
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        Document document = builder.parse(new InputSource(new StringReader(xmlString)));
        Element rootElement = document.getDocumentElement();
        String rootElementTagName = rootElement.getTagName();
        if (rootElementTagName.equalsIgnoreCase(tagName)) {
            return rootElement.getTextContent();
        } else {
            NodeList list = rootElement.getElementsByTagName(tagName);
            if (list != null && list.getLength() > 0) {
                NodeList subList = list.item(0).getChildNodes();
                if (subList != null && subList.getLength() > 0) {
                    return subList.item(0).getNodeValue();
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

From source file:com.cisco.dbds.utils.configfilehandler.FeatureFileRead_Testcase.java

/**
 * Read feature./*from  w w w.j av  a  2s . c om*/
 *
 * @param argsFileName the args file name
 * @throws IOException Signals that an I/O exception has occurred.
 */
public static void readFeature(String argsFileName) throws IOException {

    System.out.println("file2:" + argsFileName);
    BufferedReader br = new BufferedReader(new FileReader(argsFileName));
    String sCurrentLine;
    int k = 0;
    while ((sCurrentLine = br.readLine()) != null) {
        if (k == 1 && !sCurrentLine.trim().equals("")) {
            System.out.println("Title " + sCurrentLine);
            String[] title = sCurrentLine.split(":");
            if (title.length > 1)
                bw.write(title[1]);

            bw.newLine();
            k = 0;
        }
        if (sCurrentLine.contains("@Ttv")) {
            System.out.println("id " + sCurrentLine);
            String[] id = sCurrentLine.split("@");
            int o = 0, idp = 0;
            for (int k1 = 0; k1 < id.length - 1; k1++) {
                String o1 = id[k1].trim();
                if (o1.equalsIgnoreCase("sanity") || o1.equalsIgnoreCase("regression,sanity"))
                    o = k1;
                if (o1.startsWith("Ttv"))
                    idp = k1;
            }
            System.out.println(o);
            String t = argsFileName.replace("\\", "-");
            String fname[] = t.split("-");
            bw.write(fname[fname.length - 1] + ":" + id[o] + ":" + id[idp] + ":");
            k = 1;
        }

    }
    br.close();
}

From source file:org.jasig.cas.adaptors.ldap.util.SpringLdapUtils.java

/**
 * Checks if the <code>objectclass</code> Attribute of the DirContext contains the given objectclass
 *
 * @param ctx         the DirContextAdaper to check
 * @param objectclass the objectclass value to look for (case does not matter)
 * @return <code>true</code>, if the DirContext contains the objectclass, otherwise <code>false</code>
 *//*from  w w  w .  jav  a  2s .  co m*/
public static boolean containsObjectClass(final DirContextAdapter ctx, final String objectclass) {
    final String[] objectclasses = ctx.getStringAttributes(OBJECTCLASS_ATTRIBUTE);
    if (objectclasses == null || objectclasses.length == 0)
        return false;
    for (int i = 0; i < objectclasses.length; i++) {
        final String ocls = objectclasses[i];
        if (ocls.equalsIgnoreCase(objectclass))
            return true;
    }
    return false;
}

From source file:com.netdimensions.client.Client.java

private static int defaultPort(final String scheme) {
    if (scheme.equalsIgnoreCase("https")) {
        return 443;
    } else if (scheme.equalsIgnoreCase("http")) {
        return 80;
    } else {/*from   w  w w  .  j ava2  s.  co  m*/
        throw new IllegalArgumentException("Unsupported scheme: '" + scheme + "'");
    }
}