Quote the given string if needed

@param value The value to quote (e.g. bob)
@return The quoted string (e.g. "bob")
182559
public static String quote(final String value) {
        if (value == null) {
            return null;
        }
        String result = value;
        if (!result.startsWith("\"")) {
            result = "\"" + result;
        }
        if (!result.endsWith("\"")) {
            result = result + "\"";
        }
        return result;
    }
418010
public String format(Object value) {
    ValueFormatter<Object> valueFormatter = VALUE_FORMATTERS.get(value.getClass());
    if (valueFormatter != null) {
      return valueFormatter.format(this, value);
    } else {
      return value.toString();
    }
  }
924275
public static String text(String value) {
        return value != null ? StringEscapeUtils.escapeHtml4(value) : value;
    }
235267
public static String escape(String value)
    {
        String search = "&<>";
        String[] replace = {"&amp;", "&lt;", "&gt;"};

        StringBuilder buf = new StringBuilder();

        for (int i = 0; i < value.length(); i++)
        {
            char c = value.charAt(i);
            int pos = search.indexOf(c);
            if (pos < 0)
                buf.append(c);
            else
                buf.append(replace[pos]);
        }

        return buf.toString();
    }
1088879
public static function quoteString(?string $value): string
  {
    if ($value===null || $value==='') return 'null';

    return "'".self::$mysqli->real_escape_string($value)."'";
  }
1332076
public static String asStringUnchecked(final Object value) {
    try {
      return asString(value);
    } catch (JsonProcessingException e) {
      throw new RuntimeException(e);
    }
  }
34452
public static String replaceDoubleSingleQuotes( String value )
	{
		int idx = value.indexOf("''");
		if (idx == -1)
			return value;
		
		int len = value.length();
		int pos = 0;
		StringBuilder sb = new StringBuilder(len);
		while (idx != -1)
		{
			if (idx > pos)
			{
				sb.append(value.substring(pos, idx));
				pos += (idx-pos);
			}
			
			sb.append("'");	
			pos+=2;
			
			idx = value.indexOf("''",pos);
		}
		if (pos < len)
			sb.append(value.substring(pos, len));
			
		return sb.toString();
	}
981908
public static String escapeString(String value, boolean noBackslashEscapes) {
    if (!value.contains("'")) {
      if (noBackslashEscapes) {
        return value;
      }
      if (!value.contains("\\")) {
        return value;
      }
    }
    String escaped = value.replace("'", "''");
    if (noBackslashEscapes) {
      return escaped;
    }
    return escaped.replace("\\", "\\\\");
  }
1177719
public static String getAsString(Object value) {
		String result = null;
		if (value == null) {
			result = "";
		} else if (value instanceof Double) {
			double n = (Double) value;
			result = n == (long) n ? String.format("%d",(long) n) : String.format("%s", n);
		} else if (value instanceof Date) {
			SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
			String date = df.format((Date) value);

			result = date.substring(0, date.length() - 2) + ":" + date.substring(date.length() - 2, date.length());
		} else {
			result = value.toString();
		}

		return result;
	}
19828
public String toStringWithQuote() {
        StringBuilder buf = new StringBuilder();
        for (String arg : args) {
            if(buf.length()>0)  buf.append(' ');

            if(arg.indexOf(' ')>=0 || arg.length()==0)
                buf.append('"').append(arg).append('"');
            else
                buf.append(arg);
        }
        return buf.toString();
    }
124777
public static String javaQuotedLiteral(String value)
    {
        StringBuilder b = new StringBuilder(value.length() * 2);
        b.append('"');
        for (int i = 0; i < value.length(); i++) {
            char c = value.charAt(i);
            switch (c) {
                case '"': b.append("\\\""); break;
                case '\\': b.append("\\\\"); break;
                case '\n': b.append("\\n"); break;
                case '\r': b.append("\\t"); break;
                case '\t': b.append("\\r"); break;
                case '\0': b.append("\\000"); break;  // Inserting '\0' isn't safe if there's a digit after
                default:
                    if (c >= 0x20 && c <= 0x7e) {
                        b.append(c);
                    } else {
                        int h1 = (c >> 12) & 0xf;
                        int h2 = (c >> 8) & 0xf;
                        int h3 = (c >> 4) & 0xf;
                        int h4 = c & 0xf;
                        b.append("\\u");
                        b.append(hexDigit(h1));
                        b.append(hexDigit(h2));
                        b.append(hexDigit(h3));
                        b.append(hexDigit(h4));
                    }
                    break;
            }
        }
        b.append('"');
        return b.toString();
    }
1125035
public static String escape(String value, char quote) {
    Map<CharSequence, CharSequence> lookupMap = new HashMap<>();
    lookupMap.put(Character.toString(quote), "\\" + quote);
    lookupMap.put("\\", "\\\\");

    final CharSequenceTranslator escape =
        new LookupTranslator(lookupMap)
                .with(new LookupTranslator(EntityArrays.JAVA_CTRL_CHARS_ESCAPE))
                .with(JavaUnicodeEscaper.outsideOf(32, 0x7f));

    return quote + escape.translate(value) + quote;
  }
197792
public static String fixValue(String value) {
		if (value != null && !value.equals("")) {
			final String[] words = value.toLowerCase().split("_");
			value = "";
			for (final String word : words) {
				if (word.length() > 1) {
					value += word.substring(0, 1).toUpperCase() + word.substring(1) + " ";
				} else {
					value = word;
				}
			}
		}
		if (value.contains("\\n")) {
			value = value.replace("\\n", System.getProperty("line.separator"));
		}
		return value;
	}
937341
public static String getExactlyValue(final String value) {
        return null == value ? null : CharMatcher.anyOf("[]`'\"").removeFrom(value);
    }
1174436
public JSONBuilder quote(String value) {
        _sb.append('"');
        for (int i = 0; i < value.length(); ++i) {
            char c = value.charAt(i);
            switch (c) {
            case '"':
                _sb.append("\\\"");
                break;
            case '\\':
                _sb.append("\\\\");
                break;
            default:
                if (c < 0x20) {
                    _sb.append(CTRLCHARS[c]);
                } else {
                    _sb.append(c);
                }
                break;
            }
        }
        _sb.append('"');
        return this;
    }
246924
public static void maybeQuote(StringBuilder buf, String value) {
        if (value==null || value.length()==0) {
            buf.append("\"\"");
        } else if (alreadyQuoted(value)) {
            buf.append('"');
            buf.append(escapeDoubleQuotes(value,1,value.length()-1));
            buf.append('"');
        } else if ((isHttpToken(value) && !ALLOW_HTTP_SEPARATORS_IN_V0) ||
                (isV0Token(value) && ALLOW_HTTP_SEPARATORS_IN_V0)) {
            buf.append('"');
            buf.append(escapeDoubleQuotes(value,0,value.length()));
            buf.append('"');
        } else {
            buf.append(value);
        }
    }
912352
public static Expression constant(final String value) {
    checkNotNull(value);
    checkArgument(
        Utf8.encodedLength(value) <= MAX_CONSTANT_STRING_LENGTH,
        "String is too long when encoded in utf8");
    return stringConstant(value);
  }