Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Removing break lines from a .txt file
Message
De
21/02/2007 13:32:22
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01197525
Message ID:
01197704
Vues:
15
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform