Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce recorddelim to CSV.write #376

Closed
wants to merge 1 commit into from

Conversation

andyferris
Copy link
Member

Users can specify the delimeter for terminating records as a new keyword argument recorddelim. The default remains '\n'.

Resolves #375.

If the approach seems reasonable I can add tests and docs.

Users can specify the delimeter for terminating records as a new keyword argument `recorddelim`. The default remains `'\n'`.
Copy link
Member

@quinnj quinnj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather call the keyword argument newline if you're alright w/ that. Could you add a test and docs as well?

@@ -154,6 +155,7 @@ end
# handle unknown schema case
function write(::Nothing, rows, file::Union{String, IO};
delim::Union{Char, String}=',',
recorddelim::Union{Char, String}='\n',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather just call this newline

Copy link
Member Author

@andyferris andyferris Jan 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to oblige... but technically the record seperator doesn't have to be a line seperator at all.

For example, our literal matrices might have field delimiter ' ' and record delimiter ';' and no newlines.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe newrow?

@nalimilan
Copy link
Member

A bit off-topic, but it would be nice to accept both \n and \r\n by default, without using a String to avoid a performance hit (maybe a tuple of Char)?

quinnj added a commit that referenced this pull request Apr 29, 2019
* Add `decimal` keyword argument to support custom float printing (fixes #385)
* Add additional validation of quote/escape character arguments (fixes #369)
* Add `quotestrings` keyword argument to support forcing all strings to be quoted (fixes #362)
* Add `newline` keyword argument to support a custom row separator (fixes #375, supersedes #376)
@quinnj quinnj mentioned this pull request Apr 29, 2019
@quinnj
Copy link
Member

quinnj commented Apr 29, 2019

Implemented in #406

@quinnj quinnj closed this Apr 29, 2019
quinnj added a commit that referenced this pull request Apr 30, 2019
* CSV.write enhancements

* Add `decimal` keyword argument to support custom float printing (fixes #385)
* Add additional validation of quote/escape character arguments (fixes #369)
* Add `quotestrings` keyword argument to support forcing all strings to be quoted (fixes #362)
* Add `newline` keyword argument to support a custom row separator (fixes #375, supersedes #376)

* Fix grisu use in 1.0
@nalimilan nalimilan deleted the andyferris-recorddelim branch April 30, 2019 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom newline character
3 participants