public boolean isSame(String scope) { return StringUtils.endsWithIgnoreCase(this.scope, scope); }
public static Parser fromContentType(String contentType) { if(contentType == null) { return null; } contentType = ContentTypeExtractor.getContentTypeWithoutCharset(contentType.toLowerCase()); final Parser foundParser; if(contains(XML.contentTypes, contentType) || endsWithIgnoreCase(contentType, PLUS_XML)) { foundParser = XML; } else if(contains(JSON.contentTypes, contentType) || endsWithIgnoreCase(contentType, PLUS_JSON)) { foundParser = JSON; } else if(contains(TEXT.contentTypes, contentType)) { foundParser = TEXT; } else if(contains(HTML.contentTypes, contentType) || endsWithIgnoreCase(contentType, PLUS_HTML)) { foundParser = HTML; } else { foundParser = null; } return foundParser; } }
return str; if (endsWithIgnoreCase(str, remove)) { return str.substring(0, str.length() - remove.length());
public static ContentType fromContentType(String contentType) { if (contentType == null) { return null; } contentType = ContentTypeExtractor.getContentTypeWithoutCharset(contentType.toLowerCase()); final ContentType foundContentType; if (contains(XML.ctStrings, contentType) || endsWithIgnoreCase(contentType, PLUS_XML)) { foundContentType = XML; } else if (contains(JSON.ctStrings, contentType) || endsWithIgnoreCase(contentType, PLUS_JSON)) { foundContentType = JSON; } else if (contains(TEXT.ctStrings, contentType)) { foundContentType = TEXT; } else if (contains(HTML.ctStrings, contentType) || endsWithIgnoreCase(contentType, PLUS_HTML)) { foundContentType = HTML; } else if (contains(URLENC.ctStrings, contentType)) { foundContentType = URLENC; } else if (contains(BINARY.ctStrings, contentType)) { foundContentType = BINARY; } else if (contains(ANY.ctStrings, contentType)) { foundContentType = ANY; } else { foundContentType = null; } return foundContentType; }
foundModuleJarFiles.addAll(FileUtils.listFiles(new File(path), new String[]{"jar"}, false)); } else { if(StringUtils.endsWithIgnoreCase(fileOfPath.getPath(), ".jar")) { foundModuleJarFiles.add(fileOfPath);
@Override public Boolean evaluate(FunctionArgs args, EvaluationContext context) { final String value = valueParam.required(args, context); final String suffix = suffixParam.required(args, context); final boolean ignoreCase = ignoreCaseParam.optional(args, context).orElse(false); if (ignoreCase) { return StringUtils.endsWithIgnoreCase(value, suffix); } else { return StringUtils.endsWith(value, suffix); } }
/** * Test StringUtils.endsWithIgnoreCase() */ @Test public void testEndsWithIgnoreCase() { assertTrue("endsWithIgnoreCase(null, null)", StringUtils.endsWithIgnoreCase(null, null)); assertFalse("endsWithIgnoreCase(FOOBAR, null)", StringUtils.endsWithIgnoreCase(FOOBAR, null)); assertFalse("endsWithIgnoreCase(null, FOO)", StringUtils.endsWithIgnoreCase(null, FOO)); assertTrue("endsWithIgnoreCase(FOOBAR, \"\")", StringUtils.endsWithIgnoreCase(FOOBAR, "")); assertFalse("endsWithIgnoreCase(foobar, foo)", StringUtils.endsWithIgnoreCase(foobar, foo)); assertFalse("endsWithIgnoreCase(FOOBAR, FOO)", StringUtils.endsWithIgnoreCase(FOOBAR, FOO)); assertFalse("endsWithIgnoreCase(foobar, FOO)", StringUtils.endsWithIgnoreCase(foobar, FOO)); assertFalse("endsWithIgnoreCase(FOOBAR, foo)", StringUtils.endsWithIgnoreCase(FOOBAR, foo)); assertFalse("endsWithIgnoreCase(foo, foobar)", StringUtils.endsWithIgnoreCase(foo, foobar)); assertFalse("endsWithIgnoreCase(foo, foobar)", StringUtils.endsWithIgnoreCase(bar, foobar)); assertTrue("endsWithIgnoreCase(foobar, bar)", StringUtils.endsWithIgnoreCase(foobar, bar)); assertTrue("endsWithIgnoreCase(FOOBAR, BAR)", StringUtils.endsWithIgnoreCase(FOOBAR, BAR)); assertTrue("endsWithIgnoreCase(foobar, BAR)", StringUtils.endsWithIgnoreCase(foobar, BAR)); assertTrue("endsWithIgnoreCase(FOOBAR, bar)", StringUtils.endsWithIgnoreCase(FOOBAR, bar)); // javadoc assertTrue(StringUtils.endsWithIgnoreCase("abcdef", "def")); assertTrue(StringUtils.endsWithIgnoreCase("ABCDEF", "def")); assertFalse(StringUtils.endsWithIgnoreCase("ABCDEF", "cde")); // "alpha,beta,gamma,delta".endsWith("DELTA") assertTrue("endsWith(\u03B1\u03B2\u03B3\u03B4, \u0394)", StringUtils.endsWithIgnoreCase("\u03B1\u03B2\u03B3\u03B4", "\u0394")); // "alpha,beta,gamma,delta".endsWith("GAMMA") assertFalse("endsWith(\u03B1\u03B2\u03B3\u03B4, \u0393)", StringUtils.endsWithIgnoreCase("\u03B1\u03B2\u03B3\u03B4", "\u0393")); }
private boolean isCompressed(String resource) { return endsWithIgnoreCase(resource, ".zip") || endsWithIgnoreCase(resource, ".jar"); } }
public static ContentType fromContentType(String contentType) { if (contentType == null) { return null; } contentType = ContentTypeExtractor.getContentTypeWithoutCharset(contentType.toLowerCase()); final ContentType foundContentType; if (contains(XML.ctStrings, contentType) || endsWithIgnoreCase(contentType, PLUS_XML)) { foundContentType = XML; } else if (contains(JSON.ctStrings, contentType) || endsWithIgnoreCase(contentType, PLUS_JSON)) { foundContentType = JSON; } else if (contains(TEXT.ctStrings, contentType)) { foundContentType = TEXT; } else if (contains(HTML.ctStrings, contentType) || endsWithIgnoreCase(contentType, PLUS_HTML)) { foundContentType = HTML; } else { foundContentType = null; } return foundContentType; }
public static Parser fromContentType(String contentType) { if(contentType == null) { return null; } contentType = ContentTypeExtractor.getContentTypeWithoutCharset(contentType.toLowerCase()); final Parser foundParser; if(contains(XML.contentTypes, contentType) || endsWithIgnoreCase(contentType, PLUS_XML)) { foundParser = XML; } else if(contains(JSON.contentTypes, contentType) || endsWithIgnoreCase(contentType, PLUS_JSON)) { foundParser = JSON; } else if(contains(TEXT.contentTypes, contentType)) { foundParser = TEXT; } else if(contains(HTML.contentTypes, contentType) || endsWithIgnoreCase(contentType, PLUS_HTML)) { foundParser = HTML; } else { foundParser = null; } return foundParser; } }
/** * Finds the corresponding {@link URL} in class path grouped by folder {@link Map} for the given artifact {@link File}. * * @param classpathFolders a {@link Map} that has as entry the folder of the artifacts from class path and value a {@link List} * with the artifacts (jar, tests.jar, etc). * @param artifactResolvedFile the {@link Artifact} resolved from the Maven dependencies and resolved as SNAPSHOT * @return {@link URL} for the artifact found in the class path or {@code null} */ private URL findArtifactUrlFromClassPath(Map<File, List<URL>> classpathFolders, File artifactResolvedFile) { List<URL> urls = classpathFolders.get(artifactResolvedFile.getParentFile()); logger.debug("URLs found for '{}' in class path are: {}", artifactResolvedFile, urls); if (urls.size() == 1) { return urls.get(0); } // If more than one is found, we have to check for the case of a test-jar... Optional<URL> urlOpt; if (endsWithIgnoreCase(artifactResolvedFile.getName(), TESTS_JAR)) { urlOpt = urls.stream().filter(url -> toFile(url).getAbsolutePath().endsWith(TESTS_JAR)).findFirst(); } else { urlOpt = urls.stream() .filter(url -> { String filePath = toFile(url).getAbsolutePath(); return !filePath.endsWith(TESTS_JAR) && filePath.endsWith(JAR_EXTENSION); }).findFirst(); } return urlOpt.orElse(null); }
return !(endsWithIgnoreCase(file, POM_XML) || endsWithIgnoreCase(file, POM_EXTENSION) || endsWithIgnoreCase(file, ZIP_EXTENSION)); }).collect(toList());
/** * Return true if, and only if, location ends with <code>rice-properties.xml</code> (case insensitive). */ public static final boolean isRiceProperties(String location) { return StringUtils.endsWithIgnoreCase(location, Constants.RICE_PROPERTIES_SUFFIX); }
@Override public boolean endsWithIgnoreCase(String text, String expected) { return StringUtils.endsWithIgnoreCase(text, expected); }
protected String calcPageBaseName() { String name = getPageName(); String[] suffixes = new String[]{ISdkProperties.SUFFIX_PAGE_WITH_NODES, ISdkProperties.SUFFIX_PAGE_WITH_TABLE, "Page"}; for (String suffix : suffixes) { if (StringUtils.endsWithIgnoreCase(name, suffix)) { name = name.substring(0, name.length() - suffix.length()); } } return name; }
@Override protected boolean handle(String input, String searchString, boolean ignoreCase) { if (ignoreCase) { return StringUtils.endsWithIgnoreCase(input, searchString); } else { return StringUtils.endsWith(input, searchString); } }
public static String getDriver(Object obj) { Map<String, Object> fields = DataUtils.getFields(obj); for (Map.Entry<String, Object> field : fields.entrySet()) { if (StringUtils.endsWithIgnoreCase(field.getKey(), MachineConstants.CONFIG_FIELD_SUFFIX) && field.getValue() != null) { return StringUtils.removeEndIgnoreCase(field.getKey(), MachineConstants.CONFIG_FIELD_SUFFIX); } } return null; }
protected Table getTable(String location, KualiDatabase database, String extension) { String filename = LocationUtils.getFilename(location); if (!StringUtils.endsWithIgnoreCase(filename, extension)) { throw new IllegalArgumentException(location + " does not end with " + extension); } int end = filename.length() - extension.length(); String tableName = StringUtils.substring(filename, 0, end); return getTable(database, tableName); }
public static long getBytes(String size, List<String> tokens, int base) { Assert.notBlank(size); for (int i = 0; i < tokens.size(); i++) { String token = tokens.get(i); long multiplier = (long) Math.pow(base, i); if (StringUtils.endsWithIgnoreCase(size, token)) { return getByteValue(size, token, multiplier); } } // Assume bytes return getByteValue(size, "", 1); }
public static boolean endsWithIgnoreCase(ActionContext actionContext){ Thing self = actionContext.getObject("self"); CharSequence cs1 = (CharSequence) self.doAction("getCs1", actionContext); CharSequence cs2 = (CharSequence) self.doAction("getCs2", actionContext); return StringUtils.endsWithIgnoreCase(cs1, cs2); }