List of utility methods to do String Quote
String | quote(String s) quote return "'" + s.replace("'", "''").replace("&", "&").replace("<", "<") + "'"; |
String | quote(String s) quote int slashEIndex = s.indexOf("\\E"); if (slashEIndex == -1) return "\\Q" + s + "\\E"; StringBuffer sb = new StringBuffer(s.length() * 2); sb.append("\\Q"); slashEIndex = 0; int current = 0; while ((slashEIndex = s.indexOf("\\E", current)) != -1) { ... |
String | quote(String s) Wrap the given string in quotation marks. return "\"" + s + "\""; |
String | quote(String s) returns a quoted version of s with all internal quotes escaped String escaped = s.replaceAll("\\\"", "\\\\\""); return "\"" + escaped + "\""; |
String | quote(String s) quote if (s.indexOf(' ') >= 0) { char dqc = '"', sqc = '\''; int len = s.length(); if (s.charAt(0) == dqc && s.charAt(len - 1) == dqc) return s; if (s.charAt(0) == sqc && s.charAt(len - 1) == sqc) return s; String qs = (s.indexOf(dqc) >= 0) ? "'" : "\""; ... |
String | quote(String s) quote return DOUBLE_QUOTE + s.replaceAll(UNESCAPED_DOUBLE_QUOTE, ESCAPED_DOUBLE_QUOTE) + DOUBLE_QUOTE;
|
String | quote(String s) Adds a pair of quotes ("x") if no quotes (" or ') are present. if (s == null) { return null; char startChar = s.charAt(0); char endChar = s.charAt(s.length() - 1); if ((startChar == '\'' || startChar == '"') && startChar == endChar) return s; else ... |
String | quote(String s) Quotes the specified string, or returns "(null)" if it is null .
if (s != null) { String quoted = '"' + s + '"'; return quoted; } else { return "(null)"; |
String | quote(String s, char ch) quote return !isQuoted(s, ch) ? ch + s + ch : s;
|
String | quote(String s, String nullResult) Returns a quoted version of a given string, i.e. if (s == null) { return nullResult; StringBuffer result = new StringBuffer(); result.append('"'); int length = s.length(); for (int i = 0; i < length; i++) { char c = s.charAt(i); ... |