Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

reading Tab delimited TXT files with Delphi 5.

722 views
Skip to first unread message

Marcello Dias

unread,
May 17, 2007, 11:41:50 AM5/17/07
to

Hi,

I惴 trying to read a Tab delimited file with Delphi 5.
I found a very easy sample in the Internet ,but unfortuantelly it seems it愀 not for Delphi 5.
http://delphi.about.com/od/delphitips2007/qt/tab_delimited.htm

The question is,What愀 the better way to import a TXT Tab delimited file with Delphi 5?

Regards,
Marcello Dias

Paul Scott

unread,
May 17, 2007, 1:36:15 PM5/17/07
to
On Thu, 17 May 2007 16:41:50 +0100, Marcello Dias <m...@ibest.com.br> wrote:
> The question is,What´s the better way to import a TXT Tab delimited file
> with Delphi 5?

Marcello,

If you've only got Delphi5 then you probably don't have
"tStringList.LoadFromFile", so you'll probably have to parse the input
lines yourself.

But look on the bright side - At least you will have saved all the time
you would have wasted trying to persuade "LoadFromFile" to accept that
large, tab-separated Excel file (with its multiple-line fields and
idiosyncratic use of quotes)

I see my CsvImporter only takes about 300 lines (counting *lots* of blank
lines and comment lines) and that handles both comma and tab separated
files, multi-line text fields, and multiple quote characters

--
Paul Scott
Information Management Systems
Macclesfield, UK.

Marcello Dias

unread,
May 17, 2007, 1:53:52 PM5/17/07
to

"Paul Scott" <paul....@inf-rem-ove-the-dashes-mansys.com> wrote:

>I see my CsvImporter only takes about 300 lines (counting *lots* of blank
>lines and comment lines) and that handles both comma and tab separated
>files, multi-line text fields, and multiple quote characters
>

And is it in Public Domain? :]}


Marcello

Liz

unread,
May 17, 2007, 2:39:56 PM5/17/07
to
Marcello Dias wrote:


> The question is,What4s the better way to import a TXT Tab delimited
> file with Delphi 5?

If your confident your data wont contain commas you could load into 1
stringlist, do search/replace for #9 to , and then copy the text into
commatext (I think it is) for d5, and work from there.. Shouldnt be
that much slower.

--
Liz the Brit
Delphi things I have released: http://www.xcalibur.co.uk/DelphiThings

Marcello Dias

unread,
May 17, 2007, 2:51:35 PM5/17/07
to

Hi

Not needed anymore
Excelent JVCL TJVcsvDataSet does the JOB.

Regards,
Marcello Dias

beantr...@mchsi.com

unread,
Jun 21, 2007, 6:03:07 PM6/21/07
to
> If you've only got Delphi5 then you probably don't have
> "tStringList.LoadFromFile", so you'll probably have to parse the input
> lines yourself.
>
> But look on the bright side - At least you will have saved all the time
> you would have wasted trying to persuade "LoadFromFile" to accept that
> large, tab-separated Excel file (with its multiple-line fields and
> idiosyncratic use of quotes)
>
> I see my CsvImporter only takes about 300 lines (counting *lots* of blank
> lines and comment lines) and that handles both comma and tab separated
> files, multi-line text fields, and multiple quote characters
>

I'm using Delphi 7 and a Stringlist to parse lines from a tab-
delimited text file. However, anytime 2 or more consecutive tabs
appear in a row, they're treated as a single delimiter. Is this by
design? If so, how do I get around it? TIA

Teri

0 new messages