Java Code Examples for org.apache.commons.lang3.StringUtils.endsWithIgnoreCase()

The following are Jave code examples for showing how to use endsWithIgnoreCase() of the org.apache.commons.lang3.StringUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Phoenicia   File: MigrationHelper.java   View Source Code Vote up 6 votes
public List<String> getRelationTableNames(String table) {
	List<String> result = new ArrayList<String>();
	String sql = "SELECT name FROM sqlite_master WHERE type='table' AND (name LIKE '" + table + "#_%' OR name LIKE '%#_" + table +"' ESCAPE '#')";
	
	Cursor c = getCursor(sql);
	
	while(c.moveToNext()) {
		String name = c.getString(c.getColumnIndexOrThrow("name"));
	
		if(!name.equalsIgnoreCase(table) && (
				StringUtils.startsWithIgnoreCase(name, table) || 
				StringUtils.endsWithIgnoreCase(name, table)
			)) {
			
			result.add(name);
		}
	}
	
	close(c);
	return result;
}
 
Example 2
Project: simm-lib   File: CurvatureMarginWeightUtils.java   View Source Code Vote up 5 votes
private static BigDecimal getNumberOfDays(String expiry) {
  if (StringUtils.endsWithIgnoreCase(expiry, TENOR_SUFFIX_YEARS)) {
    return DAYS_IN_YEAR.multiply(new BigDecimal(StringUtils.replaceIgnoreCase(expiry, TENOR_SUFFIX_YEARS, StringUtils.EMPTY)));
  } else if (StringUtils.endsWithIgnoreCase(expiry, TENOR_SUFFIX_MONTHS)) {
    return DAYS_PER_MONTH.multiply(new BigDecimal(StringUtils.replaceIgnoreCase(expiry, TENOR_SUFFIX_MONTHS, StringUtils.EMPTY)));
  } else {
    return DAYS_IN_WEEK.multiply(new BigDecimal(StringUtils.replaceIgnoreCase(expiry, TENOR_SUFFIX_WEEKS, StringUtils.EMPTY)));
  }
}
 
Example 3
Project: Fetax-AI   File: XSSFilter.java   View Source Code Vote up 5 votes
private String rmXSS(String script) {// 移除存在XSS攻击威胁的字符串

			if (StringUtils.isBlank(script)) {
				return script;
			}

			Pattern p = Pattern.compile("<root>.+</root>");// 例外处理
			Matcher m = p.matcher(script);

			if (m.find()) {
				return script;
			}

			if (StringUtils.endsWithIgnoreCase(script, "\56jsp")) {// 例外处理
				return script;
			}

			if (StringUtils.isNotEmpty(StringUtils.substringBetween(script, "【", "】"))) {// 例外处理
				return script;
			}

			script = rmXSSBetween(script, "<", ">");
			script = rmXSSBetween(script, "\"", "\"");
			script = rmXSSBetween(script, "'", "'");
			script = rmXSSBetween(script, "&lt;", ">");
			script = rmXSSBetween(script, "<", "&gt;");
			script = rmXSSBetween(script, "&lt;", "&gt;");
			script = rmXSSBetween(script, "(", ")");
			script = rmXSSDangerousCharacters(script, DANGEROUS_CHARACTERS);
			script = rmXSSDangerousCharacters(CHARACTERS_DANGEROUS, script);

			String[] temp = StringUtils.split(script);
			if (null != temp && temp.length > 0) {
				return temp[0];
			}

			return script;
		}
 
Example 4
Project: redirector   File: Request.java   View Source Code Vote up 5 votes
public boolean isUrlMatchingEntity(String entity) {
    boolean isLast = StringUtils.endsWithIgnoreCase(url, RedirectorConstants.DELIMETER + entity);
    boolean isInTheMiddle = StringUtils.containsIgnoreCase(url, RedirectorConstants.DELIMETER + entity + RedirectorConstants.DELIMETER);
    boolean isLastBeforeQueryParam = StringUtils.containsIgnoreCase(url, RedirectorConstants.DELIMETER + entity + QUERY_PARAM_START);

    return  isLast || isInTheMiddle || isLastBeforeQueryParam;
}
 
Example 5
Project: vscrawler   File: EndsWith.java   View Source Code Vote up 5 votes
@Override
protected boolean handle(String input, String searchString, boolean ignoreCase) {
    if (ignoreCase) {
        return StringUtils.endsWithIgnoreCase(input, searchString);
    } else {
        return StringUtils.endsWith(input, searchString);
    }
}
 
Example 6
Project: datax   File: Engine.java   View Source Code Vote up 5 votes
public static Configuration filterSensitiveConfiguration(Configuration configuration){
    Set<String> keys = configuration.getKeys();
    for (final String key : keys) {
        boolean isSensitive = StringUtils.endsWithIgnoreCase(key, "password")
                || StringUtils.endsWithIgnoreCase(key, "accessKey");
        if (isSensitive && configuration.get(key) instanceof String) {
            configuration.set(key, configuration.getString(key).replaceAll(".", "*"));
        }
    }
    return configuration;
}
 
Example 7
Project: awe-awesomesky   File: XSSFilter.java   View Source Code Vote up 5 votes
private String rmXSS(String script) {// 移除存在XSS攻击威胁的字符串

			if (StringUtils.isBlank(script)) {
				return script;
			}

			Pattern p = Pattern.compile("<root>.+</root>");// 例外处理
			Matcher m = p.matcher(script);

			if (m.find()) {
				return script;
			}

			if (StringUtils.endsWithIgnoreCase(script, "\56jsp")) {// 例外处理
				return script;
			}

			if (StringUtils.isNotEmpty(StringUtils.substringBetween(script, "【", "】"))) {// 例外处理
				return script;
			}

			script = rmXSSBetween(script, "<", ">");
			script = rmXSSBetween(script, "\"", "\"");
			script = rmXSSBetween(script, "'", "'");
			script = rmXSSBetween(script, "&lt;", ">");
			script = rmXSSBetween(script, "<", "&gt;");
			script = rmXSSBetween(script, "&lt;", "&gt;");
			script = rmXSSBetween(script, "(", ")");
			script = rmXSSDangerousCharacters(script, DANGEROUS_CHARACTERS);
			script = rmXSSDangerousCharacters(CHARACTERS_DANGEROUS, script);

			String[] temp = StringUtils.split(script);
			if (null != temp && temp.length > 0) {
				return temp[0];
			}

			return script;
		}
 
Example 8
Project: mafia   File: HttpUtil.java   View Source Code Vote up 5 votes
private static HttpRequest getHttpRequest(String url, Object data, String method) throws IOException {
    if (StringUtils.endsWithIgnoreCase(method, HttpMethods.GET)) {
        return requestFactory.buildGetRequest(new GenericUrl(url + genParamGet(data)));
    } else {
        Map<String, Object> paramMap = genParamMap(data);
        UrlEncodedContent urlEncodedContent = new UrlEncodedContent(paramMap);
        return requestFactory.buildRequest(method, new GenericUrl(url), urlEncodedContent);
    }
}