List of utility methods to do String Quote
String | quoteString(String s) Return a proper quoted string if the string contains the delimiter character return quoteString(s, DELIMETER);
|
String | quoteString(String s) quoteString String quoteStr = s.trim(); if (!quoteStr.startsWith("'") && !quoteStr.endsWith("'")) { quoteStr = "'" + quoteStr + "'"; return quoteStr; return s; |
String | quoteString(String s) quote String return "\"" + s + "\""; |
String | quoteString(String s) quote String if (s == null || s.equals("null") == true) { return null; return "\"" + s + "\""; |
String | quoteString(String s) Quote string and escape characters - ab'c -> 'ab''c' if (s == null) { return null; int len = s.length(); StringBuilder s2 = new StringBuilder(len + 2).append('\''); for (int i = 0; i < len; i++) { char ch = s.charAt(i); s2.append(ch); ... |
String | quoteString(String s) quote String assert s != null; if (s.contains(" ")) return new StringBuilder().append("\"").append(s.replace("\"", "\\\"")).append("\"").toString(); return s.replace("\"", "\\\""); |
String | QuoteString(String source) Quotes the string. return '"' + source + '"'; |
String | quoteString(String source, char quote) Quote a string so that it can be used as an identifier or a string literal in SQL statements. StringBuffer quoted = new StringBuffer(source.length() + 2); quoted.append(quote); for (int i = 0; i < source.length(); i++) { char c = source.charAt(i); if (c == quote) quoted.append(quote); quoted.append(c); quoted.append(quote); return quoted.toString(); |
String | quoteString(String src) Return a string in which all the quotable characters (tab, newline, ' and ", etc) are quoted, Java-style. StringBuffer buf = new StringBuffer(); for (int i = 0; i < src.length(); i++) { char c = src.charAt(i); if (c == '\n') buf.append("\\n"); else if (c == '\r') buf.append("\\r"); else if (c == '\t') ... |
String | quoteString(String str) Wrap the given string with single quote. if (null == str) { return str; StringBuffer dstStr = new StringBuffer(str.length() + 2); if (null != str) { dstStr.append("'").append(str).append("'"); return dstStr.toString(); ... |