List of utility methods to do CSV String Escape
String | csvEscape(String str) csv Escape if (str == null) { return str; str = str.replaceAll("\"", "\"\""); return str; |
String | csvEscapeXML(String value) csv Escape XML StringBuilder tag = new StringBuilder(); for (char c : value.toCharArray()) { switch (c) { case '&': tag.append("&"); break; case '<': tag.append("<"); ... |
String | csvFormat(Object... obj) csv Format String retval = ""; for (Object o : obj) { if (retval.length() > 0) { retval += ","; if (o == null) { o = ""; String s = o.toString(); s = s.replaceAll("\\\\", "\\\\\\\\"); s = s.replaceAll("\"", "\\\""); retval += "\"" + s + "\""; return retval; |
String | CSVFormat(String data) CSV Format return "\"" + data + "\", "; |