Java Utililty Methods String Single Quote

List of utility methods to do String Single Quote

Description

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

Method

StringsingleQuote(final String text)
Add single quotes ' around the text.
final StringBuilder b = new StringBuilder((text != null ? text.length() : 0) + 2);
b.append(SINGLE_QUOTE);
if (text != null) {
    b.append(text);
b.append(SINGLE_QUOTE);
return b.toString();
StringsingleQuote(final String value)
Enclose the input string in single quotes if not already.
if ((value != null) && !value.isEmpty() && !isQuoted(value, SINGLE_QUOTE)) {
    return SINGLE_QUOTE.concat(value).concat(SINGLE_QUOTE);
return value;
StringsingleQuote(Object thing)
Surrounds given object's Object#toString() with single quotes.
return thing == null ? (String) null
        : new StringBuilder().append(SINGLE_QUOTE).append(thing).append(SINGLE_QUOTE).toString();
StringsingleQuote(String data)
Single quotes a string
return "\'" + data + "\'";
StringsingleQuote(String input)
Adds a single quotation to the input value
return "'" + input + "'";
StringsingleQuote(String s)
single Quote
return "'" + s + "'";
StringsingleQuote(String text)
Returns the text wrapped single quotes
return quote(text, "'");
StringsingleQuotedString(String str)
single Quoted String
StringBuilder result = new StringBuilder("'");
for (int i = 0; i < str.length(); i++) {
    char ch = str.charAt(i);
    if (ch == '\n') {
        result.append("\\n");
        continue;
    if (ch == '\r') {
...
StringsingleQuoteForSql(String val)
Encloses a value in single-quotes, to make a SQL string value.
if (val == null) {
    return "NULL";
String s0 = replace(val, "'", "''");
return "'" + s0 + "'";
StringsingleQuotize(String s)
Puts single quotes around a string.
return quotize(s, "'");