List of utility methods to do String Quote
boolean | quoteCharPresent(String quote) quote Char Present return !quote.equals(""); |
String | quoteComma(String value) quote Comma return value.replace(",", "\\,"); |
String | quoteCommandArgument(String s) quote Command Argument return new StringBuilder(s.length() + 2).append("\"").append(s).append("\"").toString(); |
String | quoteComments(String value) quote Comments char[] chars = value.toCharArray(); if (!commentProvided(chars)) { return null; StringBuilder builder = new StringBuilder(); int prev = 0; for (int i = 0; i < chars.length; i++) { if (chars[i] == 0x00) { ... |
String | quoteContentsOfNextBracket(String piece) quote Contents Of Next Bracket if (piece.trim().isEmpty()) { return ""; int openBracket = openBracket(piece, 0); if (openBracket < 0) { return piece; int closeBracket = closeBracket(piece, openBracket + 1); ... |
String | quoteCSV(Object val) Double quotes input string for CSV if needed: string contains ", \n, \r, ',' if (val == null) { return ""; } else if (val instanceof String) { return quoteCSVStr((String) val); return val.toString(); |
String | quoteCSVValue(String value, String sep) Quotes a value in CSV format converter. if (value == null) { return null; } else if (value.length() == 0) { return QUOTE + QUOTE; value = value.replaceAll(QUOTE, QUOTE + QUOTE); boolean needQuote = false; needQuote = (value.indexOf(sep) != -1) || (value.indexOf(QUOTE) != -1) || (value.indexOf('\n') != -1) ... |
CharSequence | quoted(CharSequence s) quoted final StringBuilder r = new StringBuilder(); r.append('"'); for (int i = 0; i < s.length(); ++i) { switch (s.charAt(i)) { case '\b': r.append("\\b"); break; case '\n': ... |
CharSequence | quoted(CharSequence s) quoted final StringBuilder r = new StringBuilder(); for (int i = 0; i < s.length(); ++i) { char c = s.charAt(i); if (Character.isWhitespace(c) || c == '\\') r.append('\\'); r.append(c); return r.toString(); ... |
String | quoted(final String str) quoted final StringBuffer buf = new StringBuffer(str); for (int i = buf.length() - 1; i >= 0; --i) switch (buf.charAt(i)) { case '\'': case '\\': buf.insert(i, '\\'); return buf.toString(); ... |