Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Treating lines in a string
Message
From
07/07/2003 21:07:26
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00807738
Message ID:
00807773
Views:
19
This message has been marked as a message which has helped to the initial question of the thread.
>Very good rotine
>
>
> However it go also to blank lines and process them
>
> Is there anyway to skip blank lines ?
>
> TIA
>
> Moises

You decide how to process each array element.

Sergey's code included:
...
FOR i=1 TO ALEN(laLines)
  STRTOFILE(laLines[i] + myvariable + lcCrLf, lcNewTextFile, .T.) 
ENDFOR
Each array element represents one line of the original text-file. So, you can simply add the condition like this:
FOR i=1 TO ALEN(laLines)
  if not empty(laLines[i]
    STRTOFILE(laLines[i] + myvariable + lcCrLf, lcNewTextFile, .T.) 
  endif
ENDFOR
Please note that the array approach is limited by the VFP limit of 65,000 elements per array, that is, 65,000 rows.

Other methods are available for longer files, too.

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform