List of utility methods to do String Quote
String | quoteText(String textToQuote, boolean sbAppend) quote Text if (null == textToQuote) { throw new IllegalArgumentException("textToQuote can not be null"); String[] lines = textToQuote.split("\n"); StringBuffer ret = new StringBuffer(); if (sbAppend) { ret.append("sb.append(\"").append(trimRight(lines[0].replaceAll("\"", "\\\\\""))); } else { ... |
void | quoteTo(CharSequence cs, StringBuilder target) Quotes the given string as Java string literal style, and puts it into the given buffer. target.append('"'); for (int i = 0, n = cs.length(); i < n; i++) { char c = cs.charAt(i); if (c <= 0x7f && ASCII_SPECIAL_ESCAPE[c] != 0) { target.append('\\'); target.append(ASCII_SPECIAL_ESCAPE[c]); } else if (Character.isISOControl(c) || Character.isDefined(c) == false || Character.isLowSurrogate(c)) { ... |
String[] | quoteTokenize(String clientResponse) Given the standard client response in HTTP/Digest mechanism, generate a set of string tokens that retains the quotes if (clientResponse == null) throw new IllegalArgumentException("Null client response."); return clientResponse.split(",(?=(?:[^\"]*\"[^\"]*\")+$)"); |
String | QuoteValue(String str) Quotes a string according to RFC 5322 rules. StringBuilder builder = new StringBuilder(); builder.append('"'); for (int i = 0; i < str.length(); ++i) { if (str.charAt(i) == '\\' || str.charAt(i) == '"') { builder.append('\\'); builder.append(str.charAt(i)); } else { builder.append(str.charAt(i)); ... |
String | quoteValue(String value) Quotes and escapes an attribute value by wrapping it with single quotes and escaping any single quotes inside the value. return "'" + replaceChar(value, "'", "''") + "'"; |
String | QuoteValueIfNeeded(String str) Quote Value If Needed return (!ShouldQuote(str)) ? str : QuoteValue(str);
|
String | quoteValues(String value) quote Values if (value.equals("true")) return "\"true\"^^xsd:boolean"; if (value.equals("false")) return "\"false\"^^xsd:boolean"; if (value.startsWith("\"") || (value.length() > 0 && Character.isLetter(value.charAt(0)))) return value; try { Integer.parseInt(value); ... |
String | quoteWhitespaces(String path) quote Whitespaces path = path.trim(); String[] segments = path.split("\\s"); if (segments.length > 1) { if (path.startsWith("\"") || path.startsWith("'")) return path; return "\"" + path + "\""; } else { return path; ... |
String | quoteWrap(String name) Wrap the name in double quotes String quoteName = null; if (name != null) { quoteName = "\"" + name + "\""; return quoteName; |