List of utility methods to do String Quote
String | quotes(CharSequence stringToQuote, boolean escapeQuote) Quotes the given string (eg. return "'" + (escapeQuote ? escapeQuote(stringToQuote) : stringToQuote) + "'"; |
String | quotes(String str) quotes return "\"" + str + "\""; |
String | quotesEscape(String text) quotes Escape if (text.contains(".")) { String[] values = text.split("\\."); return values[0] + "." + "\"" + values[1] + "\""; } else { return "\"" + text + "\""; |
String | QuoteSingle(String S) Quote Single return '\'' + S + '\''; |
String | quoteSpecial(String orig) Quote all "special" characters in a query. if (null == orig) { return null; return orig.replace("\\", "\\\\").replace("'", "\\'"); |
String | quoteSpecialCharacters(final String oldString) Quotes the special XML characters present in oldString so the return string can be embedded within an XML document without problems. final StringBuffer quotedString = new StringBuffer(); if (oldString == null) { return null; for (int i = 0; i < oldString.length(); i++) { if (oldString.charAt(i) == '<') { quotedString.append("<"); } else if (oldString.charAt(i) == '>') { ... |
String | quoteSQL(String string) Puts the given String into quotation marks, original quotation marks are escaped if (string == null) return "NULL"; return "'" + escapeSQL(string, false) + "'"; |
String | quoteSqlIdentifier(String identifier) Quote an SQL identifier by enclosing it in double-quote characters and escaping any double-quote characters with an extra double-quote character. StringBuffer retValue = new StringBuffer(identifier.length() + 2); final char quote = '"'; retValue.append(quote); for (int i = 0; i < identifier.length(); i++) { char ch = identifier.charAt(i); if (ch == quote) { retValue.append(quote); retValue.append(ch); retValue.append(quote); return retValue.toString(); |
String | quoteSqlIdentifier(String name) quote Sql Identifier return "`" + name + "`"; |
String | quoteSQLString(String s) Converts input String into equivalent MySQL string if (null == s) { return "NULL"; } else { return "'" + s.replace("'", "\\'") + "' "; |