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:com.thistech.spotlink.model.OpportunityType.java

public static OpportunityType get(String name) {
    if (StringUtils.containsIgnoreCase(name, "preroll")) {
        return PREROLL;
    } else if (StringUtils.containsIgnoreCase(name, "midroll")) {
        return MIDROLL;
    } else if (StringUtils.containsIgnoreCase(name, "postroll")) {
        return POSTROLL;
    } else if (StringUtils.containsIgnoreCase(name, "overlay")) {
        return OVERLAY;
    } else {/*from ww  w .  j  av a  2  s.c om*/
        return UNKNOWN;
    }
}

From source file:com.modcrafting.ultrabans.util.Formatting.java

public static String expandName(String p) {
    int m = 0;//www . j  a v a 2s .c om
    String Result = "";
    for (int n = 0; n < Bukkit.getOnlinePlayers().length; n++) {
        String str = Bukkit.getOnlinePlayers()[n].getName();
        if (StringUtils.containsIgnoreCase(str, p)) {
            m++;
            Result = str;
            if (m == 2) {
                return null;
            }
        }
        if (str.equalsIgnoreCase(p))
            return str;
    }
    if (m == 1)
        return Result;
    if (m > 1) {
        return null;
    }
    if (m < 1) {
        return p;
    }
    return p;
}

From source file:net.bible.service.format.osistohtml.taghandler.TagHandlerHelper.java

/** Return true if attribute contains the desiredValue in any case
 *///  ww w.  j  a  v  a  2 s  . com
public static boolean contains(String attributeName, Attributes attrs, String desiredValue) {
    boolean attribContainsExpectedValue = false;
    String attrValue = attrs.getValue(attributeName);
    if (attrValue != null) {
        attribContainsExpectedValue = StringUtils.containsIgnoreCase(attrValue, desiredValue);
    }
    return attribContainsExpectedValue;
}

From source file:com.microsoft.alm.plugin.external.models.ServerStatusType.java

/**
 * Figure out server status type from string
 *
 * @param statusString//from w  ww.j a v a2s  .c  o m
 * @return
 */
public static List<ServerStatusType> getServerStatusTypes(final String statusString) {
    final String[] args = StringUtils.split(statusString, ",");
    final List<ServerStatusType> types = new ArrayList<ServerStatusType>(args.length);

    for (int i = 0; i < args.length; i++) {
        if (StringUtils.equalsIgnoreCase(args[i].trim(), ADD.name())) {
            types.add(ADD);
        } else if (StringUtils.equalsIgnoreCase(args[i].trim(), DELETE.name())) {
            types.add(DELETE);
        } else if (StringUtils.equalsIgnoreCase(args[i].trim(), EDIT.name())) {
            types.add(EDIT);
        } else if (StringUtils.equalsIgnoreCase(args[i].trim(), RENAME.name())
                || StringUtils.equalsIgnoreCase(args[i].trim(), SOURCE_RENAME)) {
            types.add(RENAME);
        } else if (StringUtils.equalsIgnoreCase(args[i].trim(), UNDELETE.name())) {
            types.add(UNDELETE);
        } else if (StringUtils.containsIgnoreCase(args[i].trim(), LOCK.name())) {
            types.add(LOCK);
        } else if (StringUtils.containsIgnoreCase(args[i].trim(), BRANCH.name())) {
            types.add(BRANCH);
        } else {
            logger.error("Undocumented status from server: " + args[i]);
            types.add(UNKNOWN);
        }
    }
    return types;
}

From source file:com.censoredsoftware.library.util.StringUtil2.java

/**
 * Returns true if the <code>string</code> contains any of the strings held in the <code>collection</code>.
 *
 * @param check      the string to check.
 * @param collection the collection given.
 *///from ww  w.  j  ava  2  s  .  c o m
public static boolean containsAnyInCollection(final String check, Collection<String> collection) {
    return Iterables.any(collection, new Predicate<String>() {
        @Override
        public boolean apply(String string) {
            return StringUtils.containsIgnoreCase(check, string);
        }
    });
}

From source file:com.intuit.tank.util.FilterUtil.java

/**
 * Filters by contains//from   w w w  . ja v  a  2 s .c o m
 * @param value
 * @param filter
 * @param locale
 * @return
 */
public boolean contains(Object value, Object filter, Locale locale) {
    String filterText = (filter == null) ? null : filter.toString().trim();
    if (StringUtils.isBlank(filterText)) {
        return true;
    }

    if (value == null) {
        return false;
    }
    return StringUtils.containsIgnoreCase(value.toString(), filterText);
}

From source file:com.hangum.tadpole.sql.query.TadpoleSystemChecker.java

/**
 * is mac/*from www. ja  va 2s.  com*/
 * @return
 */
private static boolean isMac() {
    return StringUtils.containsIgnoreCase(OS, "mac"); //$NON-NLS-1$
}

From source file:io.github.jeddict.jpa.spec.extend.QueryMapping.java

public boolean refractorQuery(String prevQuery, String newQuery) {
    if (ClassDiagramSettings.isRefractorQuery() && StringUtils.containsIgnoreCase(this.getQuery(), prevQuery)) {
        this.setQuery(this.getQuery().replaceAll("\\b(?i)" + Pattern.quote(prevQuery) + "\\b", newQuery));
        return true;
    } else {/*w w w .  j a v  a 2s.  c  om*/
        return false;
    }
}

From source file:com.bstek.bdf2.core.orm.jdbc.dialect.AbstractDialect.java

/**
 * ???/*from w  ww.j a v  a2 s  . co  m*/
 * @param connection ?
 * @param dbProductName ???
 * @param dbMajorVersion ??
 * @return ?????
 */
public boolean support(Connection connection, String dbProductName, String dbMajorVersion) {
    try {
        DatabaseMetaData databaseMetaData = connection.getMetaData();
        String databaseProductName = databaseMetaData.getDatabaseProductName();
        int databaseMajorVersion = databaseMetaData.getDatabaseMajorVersion();
        boolean containsMysql = StringUtils.containsIgnoreCase(databaseProductName, dbProductName);
        if (StringUtils.isNotEmpty(dbMajorVersion)) {
            return containsMysql && Integer.valueOf(dbMajorVersion) == databaseMajorVersion;
        }
        return containsMysql;
    } catch (SQLException e) {
        return false;
    }
}

From source file:gov.nih.nci.cabig.caaers.domain.AdditionalInformationDocumentType.java

public static AdditionalInformationDocumentType getAdditionalInformationDocumentType(
        String additionalInformationDocumentType) {
    //other must not match with other_information
    if (StringUtils.containsIgnoreCase(additionalInformationDocumentType, OTHER_INFORMATION.getCode())) {
        return OTHER_INFORMATION;
    } else if (StringUtils.containsIgnoreCase(additionalInformationDocumentType, OTHER.getCode())) {
        return OTHER;
    } else {//  ww w .ja v  a  2  s .co  m
        for (AdditionalInformationDocumentType documentType : AdditionalInformationDocumentType.values()) {
            if (StringUtils.containsIgnoreCase(additionalInformationDocumentType, documentType.getCode())) {
                return documentType;
            }
        }
        return null;
    }
}