Oh that is interesting ... will have to give that a run! Thanks Wol! -----Original Message----- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wols Lists Sent: Thursday, August 16, 2012 7:40 AM To: u2-users@listserver.u2ug.org Subject: Re: [U2] CSV to Array
On 15/08/12 23:24, David Wolverton wrote: > I've done this in the past by doing this: > > SWAP DQUOTE WITH @AM > > Now, in theory, every EVEN attribute is a 'quoted' string - don't > touch the commas.... > Every ODD attribute is a 'non-quoted' string... > > Double check me here in case I've lost it... but this should work ... > seems this would be faster as well on larger records. Only thing > you'd have to test for -- if the first character is a doublequote, we > will have a blank first attribute and should not -- but that could be > tested in the END ELSE section (IF XXX = 1 THEN IF DATASTRING[1,1] = 1 > THEN CONTINUE) > Given that you're parsing on a delimiter, actually the best tool here is probably MATPARSE! You need two dimensions, however. Something like DIM ARRAY(100,2) MATPARSE STRING USING ',"' Until I actually played with it, I didn't realise it put text into column 1, and delimiters into column 2. Which makes it easy to ding through. If say you have a comma followed by two double quotes, it will put the comma in column 2, a blank in column 1, and then both double quotes in the next element in column 2. I was actually parsing a maths statement, but it was so easy ... Cheers, Wol _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users