mirror of
https://github.com/apache/commons-csv.git
synced 2025-02-28 05:49:04 +00:00
Apply configurable row delimiter by Dmitry Drozdov (SANDBOX-329).
git-svn-id: https://svn.apache.org/repos/asf/commons/sandbox/csv/trunk@1003046 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0d63758e09
commit
6eddaf8b0c
@ -50,6 +50,8 @@ public class CSVConfig {
|
||||
private char fillChar = ' ';
|
||||
/** The seperator character. Defaults to , */
|
||||
private char delimiter = ',';
|
||||
/** The row separator. Defaults to \n */
|
||||
private String rowDelimiter = "\n";
|
||||
/** Should we ignore the delimiter. Defaults to false */
|
||||
private boolean ignoreDelimiter = false;
|
||||
/** the value delimiter. Defaults to " */
|
||||
@ -184,6 +186,21 @@ public class CSVConfig {
|
||||
this.delimiter = delimiter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rowDelimiter used.
|
||||
*/
|
||||
public String getRowDelimiter() {
|
||||
return rowDelimiter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the rowDelimiter to use
|
||||
* @param rowDelimiter the row delimiter character.
|
||||
*/
|
||||
public void setRowDelimiter(String rowDelimiter) {
|
||||
this.rowDelimiter = rowDelimiter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return if the writer should ignore the delimiter character.
|
||||
*/
|
||||
|
@ -70,7 +70,7 @@ public class CSVWriter {
|
||||
}
|
||||
}
|
||||
}
|
||||
sb.append("\n");
|
||||
sb.append(config.getRowDelimiter());
|
||||
String line = sb.toString();
|
||||
writer.write(line);
|
||||
} catch(Exception e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user