本文整理匯總了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;
}