Java Utililty Methods String Quote

List of utility methods to do String Quote

Description

The list of methods to do String Quote are organized into topic(s).

Method

StringBuilderquoteForMdx(StringBuilder buf, String val)
Appends a double-quoted string to a string builder.
buf.append("\"");
String s0 = replace(val, "\"", "\"\"");
buf.append(s0);
buf.append("\"");
return buf;
StringquoteForRegEx(String input)
quote For Reg Ex
return "\\Q" + input + "\\E";
StringquoteForXML(String from)
quote For XML
String to = from.replace("&", "&"); 
to = to.replace("<", "&lt;"); 
to = to.replace(">", "&gt;"); 
to = to.replace("'", "&#39;"); 
to = to.replace("\"", "&quot;"); 
return to;
StringquoteHost(final String hostname)
Quote a hostname if it is not null
return (hostname != null) ? ("\"" + hostname + "\"") : UNKNOWN_HOST;
StringquoteHtml(final String s)
quote Html
String res = s.replace("&", "&amp;");
res = res.replace("<", "&lt;");
res = res.replace(">", "&gt;");
res = res.replace("\n", "<br>");
return res;
StringquoteHtml(String s)
quote Html
return s.replaceAll("&", "&amp;").replaceAll(">", "&gt;").replaceAll("<", "&lt;");
StringquoteHTML(String string)
quote HTML
if (string == null || string.length() == 0) {
    return "{}";
char c = 0;
int i;
int len = string.length();
StringBuilder sb = new StringBuilder(len + 4);
String t;
...
StringquoteHtmlContent(String x)
Replace special characters with entities for HTML content.
return replace(x, htmlIn, htmlOut);
StringquoteIdentifier(String identifier)
quote Identifier
return '"' + identifier + '"';
StringquoteIdentifier(String identifier, boolean isPedantic)
Surrounds identifier with "`" and duplicates these symbols inside the identifier.
return quoteIdentifier(identifier, "`", isPedantic);