Greg,
Since you copied me on the reply... I wouldn't run that sort of code on a very large file at all. That's an
O( n2 ) way of doing it. You are forcing strextract() to keep reprocessing the first part of the string for every line, that's horribly inefficient.
>An alternative to arrays:
>
>
>#DEFINE CRLF CHR(13)+CHR(10)
>LOCAL lcText, lnNumLines, lnLine, lcLine
>lcText = CRLF + FILETOSTR("myfile.txt")
>IF RIGHT(lcText,2) = CRLF
> lnNumLines = OCCURS(CRLF,lcText) - 1
>ELSE
> lnNumLines = OCCURS(CRLF,lcText)
>ENDIF
>FOR lnLine=1 TO lnNumLines
> lcLine = STREXTRACT(lcText,CRLF,CRLF,lnLine,2)
> ? lcLine
>ENDFOR
>
>
>The CRLF is added to the beginning to allow STREXTRACT to extract the first line.