List of utility methods to do String Quote
String | quoteString(String string) quote String return "'" + escapeQuote(string) + "'"; |
String | quoteString(String strVal) Replaces all newlines and carriage returns within the given string value with the corresponding html/xml expression String newStr = strVal; newStr = strReplace(newStr, "\r", " "); newStr = strReplace(newStr, "\n", " "); return newStr; |
String | quoteString(String t) quote String return "\"" + escapeString(t, true, false) + "\""; |
String | quoteString(String unquoted) quote String if (unquoted == null) return "null"; StringBuilder b = new StringBuilder(unquoted.length() + 2); b.append('"'); for (int i = 0; i < unquoted.length(); ++i) { char c = unquoted.charAt(i); if (c == '"' || c == '\\') b.append('\\'); ... |
String | quoteString(String value, boolean force) Returns the MIME type parameter value as either an HTTP token or HTTP quoted-string depending on whether or not it contains any characters that need to be escaped.
StringBuffer sb = new StringBuffer(); int len = value.length(); boolean didEscape = false; for (int i = 0; i < len; i++) { char ch = value.charAt(i); if (isHttpCtlChar(ch) || isHttpSeparatorChar(ch)) { sb.append('\\'); didEscape = true; ... |
String | quoteStringLiteral(String string) Quote a string so that it can be used as a string literal in an SQL statement. return quoteString(string, '\''); |
String | quoteStringSQL(String s) Convert a string to a SQL literal. if (s == null) { return "NULL"; int length = s.length(); StringBuilder buff = new StringBuilder(length + 2); buff.append('\''); for (int i = 0; i < length; i++) { char c = s.charAt(i); ... |
String | quoteStringSQL(String s) Convert a string to a SQL literal. if (s == null) { return "NULL"; int length = s.length(); StringBuilder buff = new StringBuilder(length + 2); buff.append('\''); for (int i = 0; i < length; i++) { char c = s.charAt(i); ... |
String | quoteStringValue(String value) Quotes the string value if it contains spaces. if (value == null) return null; boolean isSpc = false; for (int i = 0, len = value.length(); i < len; ++i) { if (Character.isSpaceChar(value.charAt(i))) { isSpc = true; break; if (isSpc) { StringBuilder buf = new StringBuilder(value.length() + 2); buf.append(QUOTE).append(value).append(QUOTE); return buf.toString(); return value; |
String | quoteText(String text) quote Text String txt = text.replaceAll("\n", "\\\\n"); txt = txt.replaceAll("\r", "\\\\r"); txt = txt.replaceAll("\t", "\\\\t"); return "\"" + txt + "\""; |