Java Utililty Methods String Single Quote

List of utility methods to do String Single Quote

  1. HOME
  2. Java
  3. S
  4. String Single Quote

Description

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

Method

String singleQuote(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();
String singleQuote(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;
String singleQuote(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();
String singleQuote(String data)
Single quotes a string
return "\'" + data + "\'";
String singleQuote(String input)
Adds a single quotation to the input value
return "'" + input + "'";
String singleQuote(String s)
single Quote
return "'" + s + "'";
String singleQuote(String text)
Returns the text wrapped single quotes
return quote(text, "'");
String singleQuotedString(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') {
...
String singleQuoteForSql(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 + "'";
String singleQuotize(String s)
Puts single quotes around a string.
return quotize(s, "'");


AltStyle によって変換されたページ (->オリジナル) /