Another Revolution Success Story - yet another release!

Alex Tweedly alex at tweedly.net
Tue Jun 29 20:00:51 EDT 2004


At 22:42 29/06/2004 +0200, MisterX wrote:

>Hi everyone,
>
>Here you are, a pretty compliant CSV importer for RunRev...

Sorry, it's not quite that simple :-)

I see two problems
1. You have a small bug, in that you only replace commas within a quoted 
field in the first occurrence on each line. The section      -- convert csv 
escaped chars
needs to be a loop, not an if condition

2. Excel default is to use doubled-quotes (duplicated-quotes) to represent 
a quote within a quoted field, not an escaped-quote. (I left in the 
fixing-up of escaped quotes, which is probably incorrect).


Here's a diff to change that .... though since I'm not experienced with 
Transcript, you can probably re-write it better than this.

-- Alex.


>62,63c62,65
><     if quote is in thisline then
><       put offset(quote, thisline) into a
>---
> >     put 1 into start
> >     repeat forever
> >       put offset(quote, thisline, start) into a
> >       if a == 0 then exit repeat
>
>65c67,70
><       if b > a then
>---
> >       if b == a+1 then
> >       put "\quotex" into char a to a+1 of thisline
> >       else
> >         if b == 0 then exit repeat
>
>67a73
> >       put b+6 into start  - to account for substitution just made

-- Alex.
-------------- next part --------------

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.707 / Virus Database: 463 - Release Date: 15/06/2004


More information about the use-livecode mailing list