Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Removing break lines from a .txt file
Message
From
21/02/2007 13:32:22
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01197525
Message ID:
01197704
Views:
14
Try this:
LOCAL lcInStr, lcOutStr

lcInStr = FILETOSTR('InFile.txt')

* Handle header termination
lcOutStr = STRTRAN(lcInStr, CHR(13) + CHR(10), '^', 1, 1)

* Tokenize good CRLF
lcOutStr = STRTRAN(lcOutStr, ',' + CHR(13) + CHR(10), '|')

* Get rid of unwanted CRLF 
lcOutStr = STRTRAN(lcOutStr, CHR(13) + CHR(10), '')

* Replace tokens
lcOutStr = STRTRAN(lcOutStr, '|', ',' + CHR(13) + CHR(10))
lcOutStr = STRTRAN(lcOutStr, '^', CHR(13) + CHR(10))

STRTOFILE(lcOutStr, 'OutFile.txt')
HTH

>Thanks Bruce and Borislav
>
>It worked great !!
>
>However I forgot to mention the header line, which I omitted
>on the sample .txt file
>
>The header line does not have a comma, so I would like to skip it from the
>treatment
>
>Could you please insert a exception for the header line in your great code below ?
>
>TIA
Previous
Reply
Map
View

Click here to load this message in the networking platform