Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Editing txt file
Message
De
09/06/2009 12:09:49
 
 
À
09/06/2009 06:08:47
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2008
Divers
Thread ID:
01404651
Message ID:
01404714
Vues:
35
this was just a jump start. Feel free to write your own better code :-)

>>How about:
>
>Peter,
>
>I would not use the $ operator since ^^^ may already be in the line at any place
>
>Better use right(..., len(m.lcTail)) == m.lcTail)) 
>
>
>
>>#DEFINE LF CHR(13)+CHR(10)
>>
>>
>>CLEAR 
>>lcTail="^^^"
>>
>>?" First crete a tst file"
>>TEXT TO lcText NOSHOW TEXTMERGE
>>line 1
>>line 2
>>line 3
>>line 4
>>NEXT line is empty
>>
>>line 7
>>NEXT line is emptyagain
>>
>>ENDTEXT
>>
>>lcFileName="ThisIsPetersTestFile.txt"
>>IF NOT FILE(FULLPATH(lcfileName))
>>	STRTOFILE(lcText, lcfileName)
>>ENDIF 
>>?lcText
>>?"-------------------------------------------------------"
>>
>>?"now  work on it"
>>lcTextOut=[]
>>lcTextIn=FILETOSTR(FULLPATH(lcfileName))
>>lnNumLines= ALINES(laText,lcTextIn)
>>FOR I =1 TO lnNumLines
>>
>>	DO CASE 
>>	CASE empty(laText[m.I]) 	&& empty line
>>		lcTextOut = lcTextOut + laText[m.I] +LF
>>	CASE lcTail$laText[m.I]		&& already has tail
>>		lcTextOut = lcTextOut + laText[m.I]+LF
>>
>>	OTHERWISE
>>		lcTextOut = lcTextOut + laText[m.I]+lcTail+LF
>>
>>	ENDCASE	
>>
>>ENDFOR 
>>
>>?lcTextOut 
>>?"-------------------------------------------------------"
>
Peter Cortiel
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform