public final class HtmlEscaper extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
escapeAll(String s,
boolean preserveExistingEntities)
Replaces the HTML special characters less-than (
<), greater-than (>),
double-quote ("), single-quote/apostrophe ('), and ampersand
(&) with their equivalent entities in HTML 4 and returns the result. |
static String |
escapeAllExceptQuotes(String s,
boolean preserveExistingEntities)
Does the same as
escapeAll(String, boolean), except doesn't replace the ASCII quotation mark
characters double-quote (") and single-quote/apostrophe ('). |
static String |
escapeAmpersands(String s,
boolean preserveExistingEntities)
Replaces ampersand (
&) characters with the equivalent HTML entity
(&) and returns the result. |
public static String escapeAll(String s, boolean preserveExistingEntities)
<), greater-than (>),
double-quote ("), single-quote/apostrophe ('), and ampersand
(&) with their equivalent entities in HTML 4 and returns the result. Also
maps the Microsoft Windows-1252 "smart quotes" characters (145-148) with their equivalent
HTML entities.s - the String to escapepreserveExistingEntities - if true, will avoid escaping the ampersand in an existing
entity like <. If false, the method will
do a normal escaping by replace all matched characters.public static String escapeAllExceptQuotes(String s, boolean preserveExistingEntities)
escapeAll(String, boolean), except doesn't replace the ASCII quotation mark
characters double-quote (") and single-quote/apostrophe (').s - the String to escapepreserveExistingEntities - if true, will avoid escaping the ampersand in an existing
entity like <. If false, the method will
do a normal escaping by replace all matched characters.public static String escapeAmpersands(String s, boolean preserveExistingEntities)
&) characters with the equivalent HTML entity
(&) and returns the result.s - the String to escapepreserveExistingEntities - if true, will avoid escaping the ampersand in an existing
entity like <. If false, the method will
do a normal escaping by replace all matched characters.Copyright © 2019 Atlassian. All rights reserved.