本文整理汇总了Java中org.apache.commons.lang3.StringUtils.replaceAll方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.replaceAll方法的具体用法?Java StringUtils.replaceAll怎么用?Java StringUtils.replaceAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.StringUtils
的用法示例。
在下文中一共展示了StringUtils.replaceAll方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: range
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* @param operator operator <,>,<=,>=
* @param field field name
* @param stringValue field value
* @return a range query
*/
static QueryBuilder range(String operator, String field, String stringValue) {
String key = StringUtils.replaceAll(field, "[<>=\\s]+$", "");
boolean nestedMode = nestedMode() && field.startsWith(PROPS_PREFIX);
RangeQueryBuilder rfb = rangeQuery(nestedMode ? getValueFieldName(stringValue) : key);
if (">".equals(operator)) {
rfb.gt(getNumericValue(stringValue));
} else if ("<".equals(operator)) {
rfb.lt(getNumericValue(stringValue));
} else if (">=".equals(operator)) {
rfb.gte(getNumericValue(stringValue));
} else if ("<=".equals(operator)) {
rfb.lte(getNumericValue(stringValue));
}
if (nestedMode) {
return nestedPropsQuery(keyValueBoolQuery(key, stringValue, rfb));
} else {
return rfb;
}
}
示例2: translate
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public String translate(String spel, Subject subject) {
if (StringUtils.isNotBlank(spel)) {
String jpql = StringUtils.replaceAll(spel, "#returnObject", "returnObject");
jpql = replaceOperators(jpql);
jpql = SpelTranslator.applySubject(jpql, subject);
log.debug("SpEL was translated to JPQL for permission filtering: [{}] --> [{}]", spel, jpql);
return jpql;
}
return spel;
}
示例3: doFilter
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public void doFilter( ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
final BodyReaderWrapper wrapper = new BodyReaderWrapper((HttpServletRequest ) request);
String requestMessage = RequestUtils.getRequestMessage(wrapper);
if (!LogUtils.getLogger().isDebugEnabled()) {
requestMessage = StringUtils.replaceAll( requestMessage, PASSWORD_FILTER_REGEX,
"enable password protection, if not debug so do not see");
}
LogUtils.getLogger().info(requestMessage);
chain.doFilter(wrapper, response);
}
示例4: filterSqlInjection
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public String filterSqlInjection ( String rawCharacters ) {
if ( StringUtils.isBlank( rawCharacters ) ) {
return rawCharacters;
}
return StringUtils.replaceAll( rawCharacters , SQL_INJECTION_REGEX , StringUtils.EMPTY );
}
示例5: filterXSSInjection
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public String filterXSSInjection ( String rawCharacters ) {
if ( StringUtils.isBlank( rawCharacters ) ) {
return rawCharacters;
}
return StringUtils.replaceAll( rawCharacters , XSS_REGEX , StringUtils.EMPTY );
}
示例6: filterSpecialCharacters
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public String filterSpecialCharacters ( String rawCharacters ) {
if ( StringUtils.isBlank( rawCharacters ) ) {
return rawCharacters;
}
return StringUtils.replaceAll( rawCharacters , SPECIAL_CHARACTERS_REGEX , StringUtils.EMPTY );
}
示例7: removeAllLineBreaks
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public static String removeAllLineBreaks(final String original) {
return StringUtils.replaceAll(original, System.getProperty("line.separator"), "");
}
示例8: createLocationURI
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
protected URI createLocationURI(final String location) throws ProtocolException {
return super.createLocationURI(StringUtils.replaceAll(location, " ", "%20"));
}
示例9: handle
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
protected String handle(String input, String second, String third) {
return StringUtils.replaceAll(input, second, third);
}
示例10: replaceWithQuotes
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* Replace search string to data with quotes.
*
* <p>Example:
* jpql="big 'value' fat value"
* search="value"
* replace="frog"
*
* <p>result="big 'frog' fat 'frog'"
*
* @param jpql the jpql string
* @param search the search string
* @param replace the replacement string
* @return jpql with data string
*/
static String replaceWithQuotes(String jpql, String search, String replace) {
if (StringUtils.isNotBlank(replace)) {
return StringUtils.replaceAll(
StringUtils.replaceAll(jpql, "'" + search + "'", "'" + replace + "'"),
search, "'" + replace + "'");
}
return jpql;
}
示例11: replaceCharset
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* 将 data 中的编码修改为 utf-8
* @author eko.zhan at 2017年8月11日 上午9:54:34
* @param data
* @return
*/
public static String replaceCharset(String data){
return StringUtils.replaceAll(data, "(?i)CONTENT=\"text/html; charset=gb2312\"", "CONTENT=\"text/html; charset=utf-8\"");
}