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(CharSequence cs)
Quotes the given string as Java string literal style, and returns it.
StringBuilder buf = new StringBuilder();
quoteTo(cs, buf);
return buf.toString();
Stringquote(CharSequence str)
quote
if (str == null)
    return "null";
int len = str.length();
StringBuilder buf = new StringBuilder(len + 10);
buf.append("\"");
for (int i = 0; i < len; i++) {
    char c = str.charAt(i);
    switch (c) {
...
Stringquote(CharSequence value)
quote
StringBuilder builder = new StringBuilder(value.length() + 2);
builder.append('"');
for (int i = 0; i < value.length(); i++) {
    char c = value.charAt(i);
    switch (c) {
    case '"':
        builder.append("\\\"");
        break;
...
CharSequencequote(final CharSequence original)
quote
final StringBuilder buff = builder().append('"');
final int len = original.length();
for (int i = 0; i < len; i++) {
    final char c = original.charAt(i);
    if (c == '"' || c == '#') {
        buff.append('#');
    buff.append(c);
...
CharSequencequote(final CharSequence phrase)
Quote the phrase from the given quote character.
int length = phrase.length();
final StringBuilder builder = new StringBuilder();
builder.append('"');
char ch = '\0';
for (int index = 0; index < length; index++) {
    ch = phrase.charAt(index);
    if (ch == '\\') {
        builder.append("\\\\").append('\\').append(phrase.charAt(++index));
...
Stringquote(final String s)
quote
if (s.startsWith("'")) {
    return s;
return "'" + s + "'";
Stringquote(final String str)
quote
return (str == null || str.length() == 0 || (str.charAt(0) == '`' && str.charAt(str.length() - 1) == '`'))
        ? str
        : new StringBuilder(str.length() + 2).append('`').append(str).append('`').toString();
Stringquote(final String str)
quote
return QUOTE + str + QUOTE;
Stringquote(final String str)
quote
return "\"" + str + "\"";
Stringquote(final String sValue)
quote
if (sValue == null)
    return sValue;
else
    return "'" + sValue + "'";