下面是测试压缩、解压缩、压缩率的代码:
procedure TForm1.Test;
var
i, j: integer;
begin
RichTextBox2.TextRTF := MyDecompress(MyCompress(RichTextBox1.TextRTF));
i := Length(RichTextBox1.TextRTF);
j := Length(MyCompress(RichTextBox1.TextRTF));
ShowMessage('Length Before Compression: ' + IntToStr(i)
+ '; Length After Compression: ' + IntToStr(j)
+ '; Compression Ratio: ' + IntToStr(Round(i/j)));
end;
(函数测试环境:Windows 2000 Profressional + Delphi 6)
新闻热点
疑难解答