Re: Parsevar question

"[email protected]" <[email protected]>
Newsgroups gmane.comp.windows.gui4cli
Message-ID <[email protected]>
> I might overlook still something, e.g. can records also contain
> commas and or double quotes?

In CSV yes.

Fields with embedded commas must be enclosed within double-quote characters.

Fields with embedded double-quote characters must be enclosed within double-quote characters, and each of the embedded double-quote characters must be represented by a pair of double-quote characters.

Both statements from:
http://en.wikipedia.org/wiki/Comma-separated_values

http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm

Fred.


--- In [email protected], "chris.kevany" <chris.kevany@...> wrote:
>
> I tried to find a full-proof solution because it's even more tricky.
> 
> Worse case, a series of records also could be all empty
> which would give a string like
> 
> text = ',,,,,,,'
> 
> I tried this and it seems to work.
> 
> // Three different cases to comment/uncomment
> Text = ',,,,,,,'
> //Text = '2352,Tuesday,2,,Comm,,WhC,C3.68'
> //Text = ',2352,Tuesday,2,,Comm,,WhC,C3.68,'
> 
> text = '"\#$text\"' // first add a single double quote at start and end
> repvar text ',' '","'
> say '$text'
> ParseVar Text ","
> say $$Parse.total
> 
> As far as I can see it always quotes all records, empty or not.
> I might overlook still something, e.g. can records also contain
> commas and or double quotes?
> 
> Chris
>




------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/gui4cli/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/gui4cli/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.