protected String escapeColumnValue(Object value) {
String stringValue = StringUtils.trim(value.toString());
if (!StringUtils.containsNone(stringValue, new char[]{'\n", ',"}))
{
return "\"" + //$NON-NLS-1$
StringUtils.replace(stringValue, "\"", "\\\"") + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
return stringValue;
}
Escaping for csv format.
- Quotes inside quoted strings are escaped with a /
- Fields containings newlines or , are surrounded by "
Note this is the standard CVS format and it's not handled well by excel. |