本文整理了Java中org.apache.commons.text.StringEscapeUtils.unescapeHtml3()
方法的一些代码示例,展示了StringEscapeUtils.unescapeHtml3()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StringEscapeUtils.unescapeHtml3()
方法的具体详情如下:
包路径:org.apache.commons.text.StringEscapeUtils
类名称:StringEscapeUtils
方法名:unescapeHtml3
暂无
代码示例来源:origin: org.apache.commons/commons-text
@Test
public void testUnescapeHtml3() {
for (final String[] element : HTML_ESCAPES) {
final String message = element[0];
final String expected = element[2];
final String original = element[1];
assertEquals(expected, StringEscapeUtils.unescapeHtml3(original), message);
final StringWriter sw = new StringWriter();
try {
StringEscapeUtils.UNESCAPE_HTML3.translate(original, sw);
} catch (final IOException e) {
}
final String actual = original == null ? null : sw.toString();
assertEquals(expected, actual, message);
}
// \u00E7 is a cedilla (c with wiggle under)
// note that the test string must be 7-bit-clean (Unicode escaped) or else it will compile incorrectly
// on some locales
assertEquals("Fran\u00E7ais", StringEscapeUtils.unescapeHtml3("Fran\u00E7ais"), "funny chars pass through OK");
assertEquals("Hello&;World", StringEscapeUtils.unescapeHtml3("Hello&;World"));
assertEquals("Hello&#;World", StringEscapeUtils.unescapeHtml3("Hello&#;World"));
assertEquals("Hello&# ;World", StringEscapeUtils.unescapeHtml3("Hello&# ;World"));
assertEquals("Hello&##;World", StringEscapeUtils.unescapeHtml3("Hello&##;World"));
}
代码示例来源:origin: smarek/Simple-Dilbert
/**
* Returns cached strip title for provided date
*
* @param dateKey LocalDate of item
* @return cached title or null
*/
public String getCachedTitle(LocalDate dateKey) {
return StringEscapeUtils.unescapeHtml3(getCachedTitle(dateKey.toString(DATE_FORMATTER) + "_title"));
}
内容来源于网络,如有侵权,请联系作者删除!