The data in the tstringlist is obtained by Directly Reading text files, or by using the idtcphttp protocol from the web page of the website.
VaR shtml: tstringlist;
Shtml: = tstringlist. Create;
Shtml. Add (data );
Icouter: = shtml. count;
Although the data contains multiple lines of text, the value of icouter is 1! To bypass this issue, add a Momo control and modify it to the following statement:
Memohtml. lines. Clear;
Memohtml. Text: = shtml. text;
Icouter: = memohtml. lines. count;
The number of lines in the text can be obtained correctly. Further analysis shows that tstringlist. Count cannot obtain the correct line as long as the string obtained from a text file contains a carriage return or line break.
Number. I don't know whether this is the feature or the Delphi7.0 bug?
Solution:
Shtml. Text: = (data );
Icouter: = shtml. count;
You can. The tstringlist. Add method does not handle carriage return line breaks.
Computer Learning Network http://www.why100000.com
Mesh Zhang Qing 2007-9-18