Paradox Community

Items in pnews.paradox-programming

Subject:Re: text parsing
Date:9 May 2019 01:00:33 -0400
From:"Kevin Zawicki" <numberjack@wi.rr.com>
Newsgroups:pnews.paradox-programming

>
The problem is that many times there is a literal comma in the text line

that is not a field separator.
<

There are many variations on this.. but technically the file is NOT comma
delimited if the data contains commas.

>
>Can I wrap the comma with something to make it a character?
<

Do you create the file?
fixed length files work best for this, no deliminator

Or comma quoted delimited.

"apple","orange","pear","raspberries, red","melon"

if you might use quotes in the data, you can look for the quote and comma.
I have found that any type-able character used to delimit (even TAB, CRLF)
can be found within the data and often use fixed length plain text.

Its not perfect (high ascii) can cause issues)... may use more space for
the blanks, but better than deliminated.

fixed at 4
a   b    c,1   d
1234123412341234







Peter <peter@removespamwhiteknight.email> wrote:
>I am running into a problem parsing a text file.
>
>I am reading the entire file into an array, all good.
>The text file uses a comma (,) to separate fields
>I use breakapart to split the fields into an array
>str.breakApart(ary2,",")
>
>The problem is that many times there is a literal comma in the text line

>that is not a field separator.
>eg: "The quick brown fox, jumped over something I forget"
>In the sample line I get two fields (two array elements) when it should

>be one. Furhter, I have to save the comma because there is another text

>line to add to it.
>
>How can I handle this?
>Can I wrap the comma with something to make it a character?
>
>Thanks for any ideas.
>
>
>Peter


Copyright © 2004 thedbcommunity.com