Now about performance.
My initial question was only about simplifying the life of a "lazy" Pascal programmer. With large text files of course perfomance is important. So here are my comments and questions.
Bart(2),
Winni(2),
the type of loop doesn't matter much if the code executed in one iteration of the loop takes a lot more time than the evaluation of the count.
jamie(2),
a) using an auxiliary StringList is easy but if the text file is large, so will the additional temporary memory.
b) Two loop pointers to memory characters(byte) doesn't seem to me to be easier or faster than handling two string indexes to strings in the list.
It also requires the knowledge of the "LineEnding" type. The nice thing with
"LoadFromFile" is that you don't have to bother.
jamie(3),
With "memo" an auxiliary StringList is also used, thus additional temporary memory.
And how can I learn about the behavior of the memory manager, is there a documention somewhere? And more importantly, is it possible to control it?
Winni(3),
your code uses an external loop, but is it faster than eljos's?
PascalDragon(1),
I concur.
MoCityMM(1),
by empty line I meant zero length string.
The Trim() function is not quite what I was looking for but interesting nonetheless.
Thaddy(1),
yes, easy but it also uses additional temporary memory. And also requires the knowledge of the LineEnding.
Bart(2),
Thaddy(2),
Please don't get me wrong. I'm not seeking to minimize my lines of code. I only want to emphasize the use of existing tools. I'm certain that our oustanding developers have thought thoroughly to optimize the libraries. For example the StringList.Sort method has been designed with optimization in mind. It doesn't matter if I need to write one or three lines of code to use it. The important is not to reinvent the wheel.