Proposal: New option to distinguish null from empty string#15
Conversation
Indicates whether a token is quoted or not.
|
What about: Open Declaration CSVFormat org.apache.commons.csv.CSVFormat.withNullString(String nullString) Returns a new CSVFormat with conversions to and from null for strings on input and output. ? |
|
Not sufficient. It does not provide a way to detect unquoted empty strings only. Take a look at the test case. https://github.com/t-suwa/commons-csv/commit/9412e001d2e3d598edb6f51e051d2ef0116ad514 or am I missing something ? |
|
I think this is now obsolete in git master, see commit ac280e7. |
* Fix comments
It is critical to distinguish null from empty string for accomplishing data migration between different RDBMS using csv files.
Unfortunately, CSVParser does not support this functionality and returns ["", "", "", ""] as a result of parsing ",,\"\",". Thus, it impossible to make nullable columns have null instead of empty string when importing data from csv files.
So I'd like to add a new option to distinguish them.
With this option on, you can get [null, null, "", null] as a result of above input data. Its default value is off and CSVParser keeps backward compatibility.