本文整理汇总了Java中org.apache.commons.lang3.StringUtils.substringsBetween方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.substringsBetween方法的具体用法?Java StringUtils.substringsBetween怎么用?Java StringUtils.substringsBetween使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.StringUtils
的用法示例。
在下文中一共展示了StringUtils.substringsBetween方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProperty
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public static String getProperty(String key) {
String value = props.getProperty(key);
if (value != null && value.contains("${") && value.contains("}")) {
String[] vars = StringUtils.substringsBetween(value, "${", "}");
if (vars != null && vars.length > 0) {
for (String var : vars) {
String varValue = System.getProperty(var, "");
value = value.replace("${" + var + "}", varValue);
LOG.info("eds-client.properties replace var: " + var + " => " + varValue);
}
}
}
return value;
}
示例2: findTagContent
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private void findTagContent() {
int startTags = StringUtils.countMatches(target, tag.getStartTag());
int endTags = StringUtils.countMatches(target, tag.getEndTag());
//make sure the amount of start and end tags are equal
if(startTags == endTags) {
String[] results = StringUtils.substringsBetween(target.toString(), tag.getStartTag().toString(), tag.getEndTag().toString());
for(String result : results) {
tagResult.addResult(result);
logger.log("Found Tag: %s", result);
}
} else {
//TODO: throw exception or something
logger.log("Tag counts don't match. Found %s start tags and %s end tags!", startTags, endTags);
}
}
示例3: rmXSSBetween
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private String rmXSSBetween(String script, final String open, final String close) {// 移除存在XSS攻击威胁的字符串
String[] xss = StringUtils.substringsBetween(script, open, close);
if (null != xss && xss.length > 0) {
for (String xs : xss) {
script = StringUtils.remove(script, open + xs + close);
log.warn(open + xs + close + "已移除");
}
}
return script;
}
示例4: getTemplateDedicatedFiles
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private List<String> getTemplateDedicatedFiles(String templateName, List<String> jsonDataFiles, List<String> templateNames) {
final List<String> templateDedicatedDataFiles = Lists.newArrayList();
for (String jsonDataFile : jsonDataFiles) {
final String[] jsonDataIds = StringUtils.substringsBetween(jsonDataFile, PatternLabConstants.SELECTOR, PatternLabConstants.SELECTOR);
if (jsonDataIds == null || jsonDataIds.length == 0) {
templateDedicatedDataFiles.add(jsonDataFile);
} else {
final String jsonDataId = jsonDataIds[0];
if (StringUtils.equalsIgnoreCase(templateName, jsonDataId) || !templateNames.contains(jsonDataId)) {
templateDedicatedDataFiles.add(jsonDataFile);
}
}
}
return templateDedicatedDataFiles;
}