List of usage examples for org.apache.commons.lang3 StringUtils containsIgnoreCase
public static boolean containsIgnoreCase(final CharSequence str, final CharSequence searchStr)
Checks if CharSequence contains a search CharSequence irrespective of case, handling null .
From source file:eu.openanalytics.rsb.AbstractITCase.java
public static void validateErrorResult(final InputStream responseStream) throws IOException { final String response = IOUtils.toString(responseStream); assertTrue(response + " should contain 'error'", StringUtils.containsIgnoreCase(response, "error")); }
From source file:com.adguard.commons.lang.Wildcard.java
/** * Returns "true" if input text is matching wildcard. * This method first checking shortcut -- if shortcut exists in input string -- than it checks regexp. * * @param input Input string/* ww w.j a v a 2 s .co m*/ * @return true if input string matches wildcard */ public boolean matches(String input) { if (StringUtils.isEmpty(input)) { return false; } boolean matchCase = ((regexpOptions & Pattern.CASE_INSENSITIVE) == Pattern.CASE_INSENSITIVE); if (matchCase && !StringUtils.contains(input, shortcut)) { return false; } if (!matchCase && !StringUtils.containsIgnoreCase(input, shortcut)) { return false; } return regexp.matcher(input).matches(); }
From source file:de.bmarwell.j9kwsolver.util.ResponseUtils.java
/** * @param response the response sent by the server. * @return the response of the server for solving a captcha. *//*w w w . jav a 2 s. co m*/ public static CaptchaSolutionResponse captchaSolveToCaptchaSolutionResponse(final String response) { CaptchaSolutionResponse csr = new CaptchaSolutionResponse(); csr.setAccepted(false); csr.setCredits(0); if (StringUtils.isEmpty(response)) { RequestToURI.LOG.debug("Content ist leer!"); return csr; } /* * Possible outcome: * NOT OK * OK * OK|8 */ if (StringUtils.containsIgnoreCase(response, "not")) { csr.setAccepted(false); } else if (StringUtils.containsIgnoreCase(response, "ok")) { csr.setAccepted(true); csr.setCredits(parseCredits(response)); } else { RequestToURI.LOG.error("Unknown response for solve request! {}.", response); csr.setAccepted(false); csr.setCredits(0); } return csr; }
From source file:com.outcastgeek.traversal.TraverseUtils.java
/** * @param pojo is the POJO to be traversed * @param pathSteps is traversal path//from ww w . j ava 2 s . c o m * @return the object a the end of the path * @throws TraverseException */ public static Object getPath(Object pojo, String... pathSteps) throws TraverseException { Object value = null; try { Class pojoClass = pojo.getClass(); Method[] declaredMethods = pojoClass.getDeclaredMethods(); int pathStepLength = pathSteps.length; logger.debug("Traversing {}...", pojo); for (int i = 0; i < pathStepLength; i++) { String step = pathSteps[i]; logger.debug("Step: {}", step); for (Method method : declaredMethods) { String methodName = method.getName(); if (StringUtils.containsIgnoreCase(methodName, step)) { value = pojoClass.getDeclaredMethod(methodName).invoke(pojo); break; } } if (i == pathStepLength - 1) { break; } else { String[] followingSteps = ArrayUtils.removeElement(pathSteps, step); return getPath(value, followingSteps); } } } catch (Exception e) { throw new TraverseException(e); } return value; }
From source file:city_planning.initialize_fields.Initialize_search_record_field_types.java
public static void init_provinces(final JTextField tf, final JTextField tf_regions) { Object[][] obj = null;/* w w w . ja va 2 s .c om*/ int i = 0; if (tf.getText().isEmpty()) { obj = new Object[provinces.size()][1]; for (Provinces.to_provinces to : provinces) { obj[i][0] = " " + to.province; i++; } } else { List<Provinces.to_provinces> in_search = new ArrayList(); for (Provinces.to_provinces to : provinces) { boolean contains = StringUtils.containsIgnoreCase(to.province, tf.getText()); if (contains) { in_search.add(to); } } obj = new Object[in_search.size()][1]; for (Provinces.to_provinces to : in_search) { obj[i][0] = " " + to.province; i++; } } JLabel[] labels = {}; int[] tbl_widths_customers = { tf.getWidth() }; String[] col_names = { "Name" }; TableRenderer tr = new TableRenderer(); TableRenderer.setPopup(tf, obj, labels, tbl_widths_customers, col_names); tr.setCallback(new TableRenderer.Callback() { @Override public void ok(TableRenderer.OutputData data) { Provinces.to_provinces to = provinces.get(data.selected_row); Field.Combo field = (Field.Combo) tf; Field.Combo field_region = (Field.Combo) tf_regions; field.setText(to.province); field.setId("" + to.id); field_region.setText(to.region); field_region.setId(to.region_id); } }); }
From source file:com.bellman.bible.service.format.osistohtml.taghandler.TitleHandler.java
@Override public void start(Attributes attrs) { //JSword adds the chapter no at the top but hide this because the chapter is in the Embedded Bible header boolean addedByJSword = attrs.getLength() == 1 && OSISUtil.GENERATED_CONTENT.equals(attrs.getValue(OSISUtil.OSIS_ATTR_TYPE)); // otherwise show if user wants Titles or the title is canonical isShowTitle = !addedByJSword && (parameters.isShowTitles() || "true".equalsIgnoreCase(attrs.getValue(OSISUtil.OSIS_ATTR_CANONICAL))); if (isShowTitle) { // ESV has subType butcom.bellmantext has lower case subtype so concatenate both and search with contains() String subtype = attrs.getValue(OSISUtil.OSIS_ATTR_SUBTYPE) + attrs.getValue(OSISUtil.OSIS_ATTR_SUBTYPE.toLowerCase(Locale.ENGLISH)); isMoveBeforeVerse = (StringUtils.containsIgnoreCase(subtype, PREVERSE) || (!verseInfo.isTextSinceVerse && verseInfo.currentVerseNo > 0)); if (isMoveBeforeVerse) { // section Titles normally come before a verse, so overwrite the, already written verse, which is rewritten on writer.finishedInserting writer.beginInsertAt(verseInfo.positionToInsertBeforeVerse); }/* w ww .j a v a2s . c o m*/ // get title type from level String titleClass = "heading" + TagHandlerHelper.getAttribute(OSISUtil.OSIS_ATTR_LEVEL, attrs, "1"); writer.write("<h1 class='" + titleClass + "'>"); } else { writer.setDontWrite(true); } }
From source file:ch.elca.training.service.impl.ConfigurationProjectServiceImpl.java
public List<Project> findByQuery(ProjectQuery query) { List<Project> projects = new ArrayList<Project>(); for (Project project : getAllProjects()) { String criteria = StringUtils.trimToEmpty(query.getMatchingText()); if (StringUtils.containsIgnoreCase(project.getName(), criteria) || StringUtils.containsIgnoreCase(project.getLeader().getVisa(), criteria) || StringUtils.containsIgnoreCase(project.getGroup().getLeader().getVisa(), criteria) || StringUtils.containsIgnoreCase("" + project.getNumber(), criteria)) { projects.add(project);// ww w .j a v a 2 s . c o m } } return projects; }
From source file:fr.brouillard.oss.jgitver.JGitverConfigurationComponent.java
@Override public boolean ignore(File pomFile) throws IOException { for (File excludedDir : excludedDirectories) { if (StringUtils.containsIgnoreCase(pomFile.getParentFile().getCanonicalFile().getCanonicalPath(), excludedDir.getCanonicalPath())) { return true; }//w w w .j a v a 2 s . co m } return false; }
From source file:graphene.dao.es.impl.WorkspaceDAOESImpl.java
@Override public long countWorkspaces(final String id, final String partialName) { final List<G_Workspace> workspacesForUser = uwDAO.getWorkspacesForUser(id); long count = 0; for (final G_Workspace w : workspacesForUser) { if (StringUtils.containsIgnoreCase(partialName, w.getTitle())) { count++;/*from w w w . j a v a2 s . c o m*/ } } return count; }
From source file:es.alrocar.poiproxy.proxy.LocalFilter.java
/** * Performs a contains operation between the {@link LocalFilter#value} * property and the attribute parameter/* w w w . jav a 2s. c om*/ * * @param attribute * @return True if passes the filter */ public boolean apply(String attribute) { if (attribute == null || value == null) { return true; } String attNoAccents = StringUtils.stripAccents(attribute); String valueNoAccents = StringUtils.stripAccents(value); return StringUtils.containsIgnoreCase(attNoAccents, valueNoAccents); }