本文整理了Java中org.apache.commons.text.StringEscapeUtils.unescapeEcmaScript()
方法的一些代码示例,展示了StringEscapeUtils.unescapeEcmaScript()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StringEscapeUtils.unescapeEcmaScript()
方法的具体详情如下:
包路径:org.apache.commons.text.StringEscapeUtils
类名称:StringEscapeUtils
方法名:unescapeEcmaScript
暂无
代码示例来源:origin: org.apache.commons/commons-text
@Test
public void testUnescapeEcmaScript() {
assertNull(StringEscapeUtils.unescapeEcmaScript(null));
assertEquals("8lvc1u+6B#-I", StringEscapeUtils.unescapeEcmaScript("8lvc1u+6B#-I"));
assertEquals("<script src=\"build/main.bundle.js\"></script>",
StringEscapeUtils.unescapeEcmaScript("<script src=\"build/main.bundle.js\"></script>"));
assertEquals("<script src=\"build/main.bundle.js\"></script>>",
StringEscapeUtils.unescapeEcmaScript("<script src=\"build/main.bundle.js\"></script>>"));
}
代码示例来源:origin: seleniumQuery/seleniumQuery
/**
* Escapes the attributes values into a valid CSS string.
* Deals with the way the CSS parser gives the attributes' values to us.
*
* @param stringValue The string value to escape into a valid CSS string
* @return The string value escaped to into a valid CSS string
*/
public static String unescapeString(String stringValue) {
String escapedString = stringValue;
char firstChar = stringValue.charAt(0);
if (firstChar == '\'' || firstChar == '"') {
escapedString = StringEscapeUtils.unescapeEcmaScript(stringValue);
escapedString = escapedString.substring(1, escapedString.length()-1);
}
return escapedString;
}
代码示例来源:origin: seleniumQuery/seleniumQuery
/**
* Escapes the attributes values into a valid CSS string.
* Deals with the way the CSS parser gives the attributes' values to us.
*
* @param stringValue The string value to escape into a valid CSS string
* @return The string value escaped to into a valid CSS string
*/
public static String unescapeString(String stringValue) {
String escapedString = stringValue;
char firstChar = stringValue.charAt(0);
if (firstChar == '\'' || firstChar == '"') {
escapedString = StringEscapeUtils.unescapeEcmaScript(stringValue);
escapedString = escapedString.substring(1, escapedString.length()-1);
}
return escapedString;
}
代码示例来源:origin: vmi/selenese-runner-java
private Map<String, String> parseKwArgs(String kwArgs) {
Map<String, String> map = new HashMap<>();
Matcher matcher = RE_KW_ARGS.matcher(kwArgs.trim());
while (matcher.find()) {
String name = matcher.group(MG_NAME);
String value = matcher.group(MG_DOUBLE_QUOTE);
if (value == null)
value = matcher.group(MG_SINGLE_QUOTE);
if (value == null)
value = matcher.group(MG_NO_QUOTE);
else
value = StringEscapeUtils.unescapeEcmaScript(value); // if quoted
map.put(name, value);
}
return map;
}
内容来源于网络,如有侵权,请联系作者删除!