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

/**
 * Return true if substring s is in p and isn't all in upper case. This is used to check the case of SYSTEM, PUBLIC,
 * DTD and EN./*from  ww  w  . ja v a  2  s.c om*/
 * @param s substring
 * @param p full string
 * @param len how many chars to check in p
 * @return true if substring s is in p and isn't all in upper case
 */
public static boolean findBadSubString(String s, String p, int len) {
    int n = s.length();
    int i = 0;
    String ps;

    while (n < len) {
        ps = p.substring(i, i + n);
        if (s.equalsIgnoreCase(ps)) {
            return (!s.equals(ps));
        }

        ++i;
        --len;
    }

    return false;
}

From source file:com.joshlong.esb.springintegration.modules.social.twitter.config.TwitterNamespaceHandler.java

private static TwitterMessageType handleParsingMessageType(BeanDefinitionBuilder builder, Element element,
        ParserContext parserContext) {/*from w  ww. j  a  v  a2s.  c  om*/
    String typeAttr = element.getAttribute("type");

    if (!StringUtils.isEmpty(typeAttr)) {
        if (typeAttr.equalsIgnoreCase(FRIENDS)) {
            return TwitterMessageType.FRIENDS;
        }

        if (typeAttr.equalsIgnoreCase(MENTIONS)) {
            return TwitterMessageType.MENTIONS;
        }

        if (typeAttr.equalsIgnoreCase(DIRECT_MESSAGES)) {
            return TwitterMessageType.DM;
        }
    }

    return TwitterMessageType.FRIENDS;
}

From source file:com.wso2telco.gsma.authenticators.attributeshare.AttributeShareFactory.java

public static AttributeSharable getAttributeSharable(String trustedStatus) {

    AttributeSharable attributeSharable = null;

    if (trustedStatus != null
            && (trustedStatus.equalsIgnoreCase(AuthenticatorEnum.TrustedStatus.TRUSTED.name()))) {
        if (trustedSp2 == null) {
            trustedSp2 = new TrustedSp2();
        }//from w w w .  j av  a2  s  .  c om
        attributeSharable = trustedSp2;
    }
    if (trustedStatus != null
            && (trustedStatus.equalsIgnoreCase(AuthenticatorEnum.TrustedStatus.FULLY_TRUSTED.name()))) {
        if (trustedSp == null) {
            trustedSp = new TrustedSp();
        }
        attributeSharable = trustedSp;
    }
    if (trustedStatus != null
            && (trustedStatus.equalsIgnoreCase(AuthenticatorEnum.TrustedStatus.UNTRUSTED.name()))) {
        if (normalSp == null) {
            normalSp = new NormalSp();
        }
        attributeSharable = normalSp;

    }
    log.debug("SP type" + attributeSharable);
    return attributeSharable;
}

From source file:com.asakusafw.runtime.workaround.snappyjava.MacSnappyJavaWorkaround.java

/**
 * Installs workaround for {@code snappy-java} if it is effective.
 * @param skipOnUnknown {@code true} to skip if version is unrecognized, otherwise {@code false}
 *//*from   w  w w . j av  a  2  s  .  co  m*/
public static void install(boolean skipOnUnknown) {
    String os = OSInfo.getOSName();
    if (os == null || os.equalsIgnoreCase("mac") == false) { //$NON-NLS-1$
        if (LOG.isDebugEnabled()) {
            LOG.debug(MessageFormat.format("not a snappy-java workaround target: os={0}", //$NON-NLS-1$
                    os));
        }
        return;
    }
    if (isFixed(skipOnUnknown)) {
        if (LOG.isDebugEnabled()) {
            LOG.debug(MessageFormat.format("not a snappy-java workaround target: version={0}", //$NON-NLS-1$
                    SnappyLoader.getVersion()));
        }
        return;
    }
    // isFixed() -> SnappyLoader.<clinit> may change System.properties
    if (System.getProperty(SnappyLoader.KEY_SNAPPY_LIB_NAME) != null) {
        if (LOG.isDebugEnabled()) {
            LOG.debug(MessageFormat.format("not a snappy-java workaround target: defined {0}={1}", //$NON-NLS-1$
                    SnappyLoader.KEY_SNAPPY_LIB_NAME, System.getProperty(SnappyLoader.KEY_SNAPPY_LIB_NAME)));
        }
        return;
    }
    LOG.info(MessageFormat.format("installing snappy-java workaround for Mac OSX: version={0}",
            SnappyLoader.getVersion()));
    System.setProperty(SnappyLoader.KEY_SNAPPY_LIB_NAME, "libsnappyjava.jnilib"); //$NON-NLS-1$
}

From source file:org.jongo.mocks.UserMock.java

public static UserMock instanceOf(final Map<String, String> columns) {
    UserMock instance = new UserMock();
    for (String k : columns.keySet()) {
        if (k.equalsIgnoreCase("id")) {
            instance.id = Integer.valueOf(columns.get(k));
        } else if (k.equalsIgnoreCase("name")) {
            instance.name = columns.get(k);
        } else if (k.equalsIgnoreCase("age")) {
            instance.age = Integer.valueOf(columns.get(k));
        } else if (k.equalsIgnoreCase("credit")) {
            instance.credit = new BigDecimal(columns.get(k));
        } else if (k.equalsIgnoreCase("birthday")) {
            instance.birthday = dateFTR.parseDateTime(columns.get(k));
        } else if (k.equalsIgnoreCase("lastupdate")) {
            instance.lastupdate = dateTimeFTR.parseDateTime(columns.get(k));
        } else {/*from  w w  w. j  av a  2  s.  co  m*/
            System.out.println("Failed to parse column " + k + " with value " + columns.get(k));
        }
    }
    return instance;
}

From source file:com.drtshock.playervaults.vaultmanagement.Serialization.java

public static ItemStack[] toItemStackArray(List<String> stringItems) {
    List<ItemStack> contents = new ArrayList<>();
    for (String piece : stringItems) {
        if (piece.equalsIgnoreCase("null")) {
            contents.add(null);//from  ww w. jav a2 s. c  o m
        } else {
            try {
                ItemStack item = (ItemStack) deserialize(toMap(new JSONObject(piece)));
                contents.add(item);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }
    ItemStack[] items = new ItemStack[contents.size()];
    for (int x = 0; x < contents.size(); x++) {
        items[x] = contents.get(x);
    }
    return items;
}

From source file:com.abuabdul.notedovn.util.NoteDovnUtil.java

public static boolean isRestrictedField(String name) {
    if (isNotEmpty(name)) {
        return name.equalsIgnoreCase("aboutNote") ? true : name.equalsIgnoreCase("noteMsg") ? true : false;
    }//from w  w  w.  j  a  va 2 s. c  o m
    return false;
}

From source file:com.intel.cosbench.client.amplistor.AmpliUtils.java

public static ArrayList<Object> unfold(String str) {
    ArrayList<Object> al = new ArrayList<Object>();
    str = trim(str, "[");
    str = trim(str, "]");

    String[] s = str.split(",");
    for (int i = 0; i < s.length; i++) {
        String se = s[i].trim();
        // parse/*from w w  w . java 2s . c o  m*/
        if (se.equalsIgnoreCase(Boolean.TRUE.toString()) || se.equalsIgnoreCase(Boolean.FALSE.toString())) {
            al.add(Boolean.parseBoolean(se));
        } else {
            try {
                long l = Long.parseLong(se);
                al.add(l);
            } catch (NumberFormatException e) {
                al.add(unquotedString(se));
            }
        }

    }

    return al;
}

From source file:cl.almejo.vsim.gui.ColorScheme.java

public static boolean exists(String name) {
    for (String schemeName : _schemes.keySet()) {
        if (schemeName.equalsIgnoreCase(name)) {
            return true;
        }//from   ww  w.  ja v  a 2 s  . c o  m
    }
    return false;
}

From source file:com.kurento.demo.player.GenericPlayer.java

public static void play(final HttpPlayerSession session) {
    // contendId discriminates between a termination or a play. In case of
    // the play, contentId selects the URL and filter to be employed
    String contentId = session.getContentId();

    if (contentId != null && contentId.equalsIgnoreCase("reject")) {
        session.terminate(407, "Reject in player handler");
    } else {//  w ww  .j  av  a 2  s .co m
        // Small video in WEBM by default (small.webm)
        String url = VideoURLs.map.get("small-webm");
        if (contentId != null && VideoURLs.map.containsKey(contentId)) {
            url = VideoURLs.map.get(contentId);
        }
        if (contentId != null && contentId.equalsIgnoreCase("jack")) {
            // Jack Vader Filter
            MediaPipelineFactory mpf = session.getMediaPipelineFactory();
            MediaPipeline mp = mpf.create();
            session.releaseOnTerminate(mp);
            PlayerEndpoint playerEndPoint = mp.newPlayerEndpoint(url).build();
            JackVaderFilter filter = mp.newJackVaderFilter().build();
            playerEndPoint.connect(filter);
            HttpGetEndpoint httpEndpoint = mp.newHttpGetEndpoint().terminateOnEOS().build();
            filter.connect(httpEndpoint);
            session.setAttribute("player", playerEndPoint);
            session.start(httpEndpoint);
        } else if (contentId != null && contentId.equalsIgnoreCase("zbar")) {
            // ZBar Filter
            MediaPipelineFactory mpf = session.getMediaPipelineFactory();
            MediaPipeline mp = mpf.create();
            PlayerEndpoint player = mp.newPlayerEndpoint(url).build();
            session.setAttribute("player", player);
            ZBarFilter zBarFilter = mp.newZBarFilter().build();
            player.connect(zBarFilter);
            HttpGetEndpoint httpEndpoint = mp.newHttpGetEndpoint().terminateOnEOS().build();
            zBarFilter.connect(httpEndpoint);
            session.start(httpEndpoint);
            session.setAttribute("eventValue", "");
            zBarFilter.addCodeFoundListener(new MediaEventListener<CodeFoundEvent>() {
                @Override
                public void onEvent(CodeFoundEvent event) {
                    log.info("Code Found " + event.getValue());
                    if (session.getAttribute("eventValue").toString().equals(event.getValue())) {
                        return;
                    }
                    session.setAttribute("eventValue", event.getValue());
                    session.publishEvent(new ContentEvent(event.getType(), event.getValue()));
                }
            });
        }

        else {
            // Player without filter
            session.start(url);
        }
    }
}