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

Stringquote(final String value)
quote
return "\"" + value + "\"";
Stringquote(final String value)
Quote the given string if needed
if (value == null) {
    return null;
String result = value;
if (!result.startsWith("\"")) {
    result = "\"" + result;
if (!result.endsWith("\"")) {
...
Stringquote(final String value)
quote
if (value == null) {
    return null;
final StringBuilder sb = new StringBuilder("\"");
int length = value.length();
for (int n = 0, cp; n < length; n += Character.charCount(cp)) {
    cp = value.codePointAt(n);
    if (cp == '\\' || cp == '"') {
...
Stringquote(Object aObject)
quote
return SINGLE_QUOTE + String.valueOf(aObject) + SINGLE_QUOTE;
Stringquote(Object s)
_more_
return "'" + s.toString() + "'";
Stringquote(Object s)
The quote() method simply adds double quotes around a string.
return QUOTE + s + QUOTE;
Stringquote(Object value)
quote
return "\"" + value + "\"";
Stringquote(String content)
quote
StringBuffer sb = new StringBuffer();
sb.append("\"");
sb.append(content);
sb.append("\"");
return sb.toString();
Stringquote(String content, String quoteMark)
surround content with quoteMark and double every quoteMark inside content
return quoteMark + content.replaceAll(quoteMark, quoteMark + quoteMark) + quoteMark;
Stringquote(String content, String quoteMark)
surround content with quoteMark and double every quoteMark inside content
return quoteMark + content.replaceAll(quoteMark, quoteMark + quoteMark) + quoteMark;