csvToText Repository

Alex Tweedly alex at tweedly.net
Tue Jun 14 10:09:42 EDT 2016



On 14/06/2016 14:33, Peter TB Brett wrote:
>
> Hi Alex,
>
> I don't think an enhancement to the split command would be adequate 
> for correct parsing of a CSV file.
>
I wasn't suggesting that. Having struggled to create the current version 
of csvToText, I am all too aware of the vagaries of csv formats :-)

I was suggesting an extension to 'split' which would enable it to handle 
the *output* from csvToText - i.e. an already cleaned-up version of the 
file, with all the CSV oddities already dealt with.

I did look at enhancing csvToText to produce a numerical-indexed array 
directly - but it would be a bit of a pain; given that we can already 
produce cleaned-up-text, it would be sufficient to have an efficient way 
to convert it to an array for convenient and efficient further 
processing. As I said, it can be done in 20 line of LC script - but not 
efficiently.
> For example, this is a single line of a valid CSV file, according to 
> some producers:
>
> > a,"b,c",d e
>
> The elements of the line are: "a", "b,c", "d" and "e".  Obviously, 
> this is best handled by parsing into an array.
Don't even start ... :-) :-)

-- Alex.




More information about the use-livecode mailing list