Example usage for org.apache.commons.lang StringUtils containsIgnoreCase

List of usage examples for org.apache.commons.lang StringUtils containsIgnoreCase

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils containsIgnoreCase.

Prototype

public static boolean containsIgnoreCase(String str, String searchStr) 

Source Link

Document

Checks if String contains a search String irrespective of case, handling null.

Usage

From source file:eu.eubrazilcc.lvl.core.util.LocaleUtils.java

/**
 * Obtains the locale that best-matches with the specified string.
 * @param str input string.//from  w ww  . ja  va 2s  .  co m
 * @return the locale that best-matches with the specified string, or {@code null}.
 */
public static @Nullable Locale getLocale(final @Nullable String str) {
    Locale locale = null;
    if (isNotBlank(str)) {
        final ImmutableList<Locale> locales = availableLocaleList();
        for (int i = 0; i < locales.size() && locale == null; i++) {
            final Locale item = locales.get(i);
            if (StringUtils.containsIgnoreCase(str, item.getDisplayCountry())) {
                locale = item;
            }
        }
    }
    return locale;
}

From source file:gov.nih.nci.cabig.caaers.datamigrator.CaaersDataMigratorTemplate.java

/**
 * Returns true if DB is Oracle/*  ww w  .  j av  a  2  s  .com*/
 * @return
 */
private boolean isOralceDB() {
    return StringUtils.containsIgnoreCase(getDBName(), "oracle");
}

From source file:net.ageto.gyrex.persistence.jdbc.pool.internal.commands.FlushPool.java

@Override
protected void doExecute() throws Exception {
    // signal global
    if (signalGlobal) {
        printf("Sending global flush event...");
        PoolActivator.getInstance().getRegistry().flushGlobal();
        printf("Global flush event sent successfully.");
        return;/*from w w w  .  j a  va2s .  co m*/
    }

    // check for exact filter match
    if ((null != poolIdFilter) && IdHelper.isValidId(poolIdFilter)) {
        final PoolDefinition pool = new PoolDefinition(poolIdFilter);
        if (pool.exists()) {
            flush(pool.getPoolId());
            return;
        }
    }

    // flush all known pools
    final String[] knownPoolIds = PoolDefinition.getKnownPoolIds();
    for (final String poolId : knownPoolIds) {
        if ((null == poolIdFilter) || StringUtils.containsIgnoreCase(poolId, poolIdFilter)) {
            flush(poolId);
        }
    }
}

From source file:com.dp2345.service.impl.MemberServiceImpl.java

@Transactional(readOnly = true)
public boolean usernameDisabled(String username) {
    Assert.hasText(username);//from   ww  w .  jav  a  2 s  .c o  m
    Setting setting = SettingUtils.get();
    if (setting.getDisabledUsernames() != null) {
        for (String disabledUsername : setting.getDisabledUsernames()) {
            if (StringUtils.containsIgnoreCase(username, disabledUsername)) {
                return true;
            }
        }
    }
    return false;
}

From source file:net.daboross.bukkitdev.playerdata.GetUsernameCommand.java

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if (args.length > 0) {
        String partialName = ArrayHelpers.combinedWithSeperator(args, " ");
        List<? extends PlayerData> playerDataList = playerHandler.getAllPlayerDatas();
        sender.sendMessage(//  w  w  w.j a v a2  s. c o  m
                String.format(ColorList.TOP_FORMAT, "AutoCompletes for " + ColorList.NAME + partialName));
        for (int numSent = 0, i = 0; i < playerDataList.size() && numSent < 10; i++) {
            PlayerData pd = playerDataList.get(i);
            if (pd.getUsername().equals(pd.getDisplayName())) {
                if (StringUtils.containsIgnoreCase(pd.getUsername(), partialName)) {
                    sender.sendMessage(ColorList.NAME + pd.getUsername());
                    numSent++;
                }
            } else {
                if (StringUtils.containsIgnoreCase(pd.getUsername(), partialName) || StringUtils
                        .containsIgnoreCase(ChatColor.stripColor(pd.getDisplayName()), partialName)) {
                    sender.sendMessage(ColorList.NAME + pd.getUsername() + ColorList.DIVIDER + " | "
                            + ColorList.NAME + pd.getDisplayName());
                    numSent++;
                }
            }
        }
    } else {
        sender.sendMessage(ColorList.ERR + "Please specify a player");
        sender.sendMessage(ColorList.CMD + "/" + label + ColorList.ARGS + " <Partial Name>");
    }
    return true;
}

From source file:com.enonic.cms.core.content.index.queryexpression.QueryParserTest.java

@Test
public void testLikeOperator() {
    QueryExpr test = parseQuery("a like 'abc'");
    assertTrue(StringUtils.containsIgnoreCase(test.getExpr().toString(), "like"));
}

From source file:com.dp2345.service.impl.ShopServiceImpl.java

@Transactional(readOnly = true)
public boolean shopAliasDisabled(String shopAlias) {
    Assert.hasText(shopAlias);//  ww w.j  a v  a  2 s .  c o  m
    Setting setting = SettingUtils.get();
    if (setting.getDisabledUsernames() != null) {
        for (String disabledUsername : setting.getDisabledUsernames()) {
            if (StringUtils.containsIgnoreCase(shopAlias, disabledUsername)) {
                return true;
            }
        }
    }
    return false;
}

From source file:com.apexxs.neonblack.utilities.Hints.java

public String containsHint(String name) {
    try {/* w  w w  . ja v  a  2 s  . com*/
        for (Map.Entry<String, String> entry : hintMap.entrySet()) {
            if (StringUtils.containsIgnoreCase(name, entry.getKey())) {
                return entry.getValue();
            }
        }
    } catch (Exception ex) {
        //Let it go, return an empty String
    }
    return StringUtils.EMPTY;
}

From source file:net.orpiske.ssps.sdm.main.DbInitializationHelper.java

private void initializeSoftwareInventory() throws SQLException, DatabaseInitializationException {
    SoftwareInventoryDao inventory = new SoftwareInventoryDao(databaseManager);

    try {/*from  w  w w  . j  a v a2 s  . c  o m*/
        inventory.getCount();
    } catch (SQLException e) {
        String err = e.getMessage();

        if (StringUtils.containsIgnoreCase(err, "does not exist")) {
            inventory.createTable();
            logger.debug("Software inventory table created successfully");
        } else {
            throw e;
        }
    }
}

From source file:gov.nih.nci.cabig.caaers.datamigrator.CaaersDataMigratorTemplate.java

/**
 * Returns true if DB is PostgreSQL//from   ww w. j a  va 2s .  c o  m
 * @return
 */
private boolean isPostgresDB() {
    return StringUtils.containsIgnoreCase(getDBName(), "postgresql");
}