Hi Peter,

> On 22 Jul 2017, at 14:12, Peter Uhnak <i.uh...@gmail.com> wrote:
> 
> Hi,
> 
> this is a continuation of an older thread about quoting fields only when 
> necessary. ( 
> http://forum.world.st/NeoCSVWriter-automatic-quotes-td4924781.html )
> 
> I've attached fileouts of NeoCSV packages with the addition (I don't know if 
> Metacello can file-out only changesets).
> 
> The change doesn't affect the default behavior, only when explicitly 
> requested.
> 
> Peter

I accepted your changes as such, the .mcz's were copied over to the main 
repositories. This is a pure & clean extension, so that is good. Thank you.

This option is always going to be slower, but the current implementation might 
be improved, I think.

The key test in #writeOptionalQuotedField:

{
  lineEnd asString.
  separator asString.
  '"' } anySatisfy: [ :each | string includesSubstring: each ]

will be quite slow. 

If we accept a little bit of (over safe) error on EOL and use any occurrence of 
CR or LF as needing a quote, we could switch to characters to test for. There 
exists a fast (primitive) test, #findFirstInString:inSet:startingAt: that can 
do all the testing in one go. If your version turns out to be slow, we could 
try that, if measurements show a difference.

Regards,

Sven 


Reply via email to