Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Delimited text file

I need a blank space after the company number in a text file that I am
importing into another program. The database holds the blank after the string
is created but when I copy the string to text file delimited with comma it
cuts off the blank. I assume it sees a blank and does not include it in the
field. I do not want to have to open this in low level and include the blank
as there is about twelve text files that I am creating for different accounts.

137955,"","",165,"5175 GATOER ENTE INVOICE",102.83," ","","00000000000000000005175".
(Blank space after 5)
[595 byte] By [Lori] at [2007-11-10 12:50:20]
# 1 Re: Delimited text file
Hi Lori,

I'd make a cursor with one memo field. I'd make a table with the names of
the twelve text files, and SCAN that table. Inside the SCAN loop I'd APPEND
BLANK to the Cursor and then APPEND MEMO MemoField FROM TextFile.txt. Now
you've got a cursor with twelve records that contain the contents of your
twelve text files.

Now I'd SCAN the Cursor and use ALINES() to read one line at a time, use
SUBSTR(), AT() etc. to find the find the comma after the CompanyNo, SUBSTR()
to get the CompanyNo, add the space, and then add the rest of the line. I'd
write the new lines + CHR(13) to a memo field in a second cursor. Finally,
I'd SCAN the second cursor and use STRTOFILE() to write the contents of the
memo field back to a text file.

I haven't tried this, but it gives you an idea of how to get started.
Someone else may have a better way.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
cindy.winegarden@mvps.org, www.cindywinegarden.com

"Lori" <Lori2-1@excite.com> wrote in message
news:3f1c0d70$1@tnews.web.dev-archive.com...
>
> I need a blank space after the company number in a text file that I am
> importing into another program. The database holds the blank after the
string
> is created but when I copy the string to text file delimited with comma it
> cuts off the blank. I assume it sees a blank and does not include it in
the
> field. I do not want to have to open this in low level and include the
blank
> as there is about twelve text files that I am creating for different
accounts.
>
> 137955,"","",165,"5175 GATOER ENTE INVOICE",102.83,"
","","00000000000000000005175".
> (Blank space after 5)
Cindy Winegarden at 2007-11-11 23:50:38 >