List of utility methods to do String Quote
String | quote(String toQuote, String specials, char quoteChar) Quote special characters. if (toQuote == null) { return ""; StringBuilder result = new StringBuilder(); char c; boolean isSpecial; for (int i = 0; i < toQuote.length(); ++i) { c = toQuote.charAt(i); ... |
String | quote(String txt) quote StringBuffer sb = new StringBuffer(""); sb.append(replace(replace(txt, "'", "'"), "", "'")); return sb.toString(); |
String | quote(String val) Wrap the provided val String in double-quotes. if (val == null) return "\"\""; return "\"" + val + "\""; |
String | quote(String val) quote if (val != null && val.length() > 0) { StringBuffer buffer = new StringBuffer(); for (int i = 0; i < val.length(); i++) { char ch = val.charAt(i); switch (ch) { case '\'': buffer.append("\\'"); break; ... |
String | quote(String val, char quote) Quote a string, escaping it into C/C++ style StringBuffer buff = new StringBuffer(); buff.append(quote); buff.append(escape(val, quote)); buff.append(quote); return buff.toString(); |
String | quote(String value) Safely escape an arbitrary string as a JSON string literal. StringBuilder toReturn = new StringBuilder("\""); for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); String toAppend = String.valueOf(c); switch (c) { case '\b': toAppend = "\\b"; break; ... |
String | quote(String value) Quote the given string; single quotes are escaped. return quote(value, '\''); |
String | quote(String value) Surrounds a value with quote characters that are not contained in the value itself. String quoteChar = "\""; if (value.contains(quoteChar)) { quoteChar = "\'"; if (value.contains(quoteChar)) { throw new IllegalArgumentException( String.format("Could not find quote char for expression: %s", value)); return String.format("%s%s%s", quoteChar, value, quoteChar); |
String | quote(String value) quote String toReturn = value; if (value != null) { StringBuilder builder = new StringBuilder(); builder.append("\""); builder.append(value); builder.append("\""); toReturn = builder.toString(); return toReturn; |
void | quote(StringBuilder buf, String str) Simple quote of a string, escaping where needed. buf.append('"'); escape(buf, str); buf.append('"'); |