cleanup and added tests

This commit is contained in:
Shekhar Gulati
2016-07-19 18:13:13 +05:30
parent acdb15d6fe
commit ec7cb02800
2 changed files with 46 additions and 2 deletions
+5 -1
View File
@@ -944,7 +944,11 @@ public abstract class Strman {
*/
public static String htmlEncode(final String html) {
validate(html, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return html.chars().mapToObj(c -> "\\u" + String.format("%04x", c).toUpperCase()).map(e -> HtmlEntities.encodedEntities.get(e)).collect(joining());
return html
.chars()
.mapToObj(c -> "\\u" + String.format("%04x", c).toUpperCase())
.map(HtmlEntities.encodedEntities::get)
.collect(joining());
}
/**