Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Remove empty lines
Message
De
19/09/2010 16:55:06
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01481722
Message ID:
01481876
Vues:
44
lcErg = ""
for lnRun to alines(laLines, FileToStr("c:\mydir\m.txt"))
    If !Empty(laLines[m.lnRun])
       lcErg = m.lcErg + laLines[m.lnRun] + Chr(13) + Chr(10)
    endif
next
= StrToFile(m.lcErg, "c:\mydir\m_Clean.txt")
This should work, as the number of closing parenthesis is correct -
>>for lnRun = 1 to alines(laLines, FileToStr("c:\mydir\m.txt")
should NOT work as opening # closing...

baffled

thomas

>ahhh - that worked. thanks mike
>same problem with sergey's solution - i have lost 'all' carriage returns now and text appears as one line.
>back to the drawing board.
>
>thanks all
>
>k
>
>
>
>>>thanks for the clarification thomas. that is in fact what i had tried however
>>>vfp underlines the sentence (ie syntax wrong)
>>
>>for lnRun = 1 to alines(laLines, FileToStr("c:\mydir\m.txt")
>>
>>alines returns number of lines. The syntax of the for next is FOR x = 1 to y ... NEXT x
>>
>>>
>>>for lnRun to alines(laLines, FileToStr("c:\mydir\m.txt"))
>>>
>>>is there an alternative?
>>>
>>>thanks
>>>k
>>>
>>>>
lcErg = ""
>>>>for lnRun to alines(laLines, FileToStr("c:\mydir\m.txt"))
>>>>    If !Empty(laLines[m.lnRun])
>>>>       lcErg = m.lcErg + laLines[m.lnRun]
>>>>    endif
>>>>next
>>>>= StrToFile(m.lcErg, "c:\mydir\m_Clean.txt")
>>>>
>>>>Overwriting with the same name might get you into other troubles,
>>>>so I prefer to keep original file unchanged.
>>>>
>>>>HTH
>>>>
>>>>thomas
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform