码迷,mamicode.com
首页 > 其他好文 > 详细

如何使用THashedStringList

时间:2016-03-16 22:22:54      阅读:219      评论:0      收藏:0      [点我收藏+]

标签:

1.添加

uses system.IniFiles

2.实例代码:

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs,System.IniFiles, Vcl.StdCtrls;
type
  Ps=^string;
type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
    gg:THashedStringList;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  str:string;
  PP:Ps;
  I:Integer;
begin
 gg:=THashedStringList.Create;
 gg.Sort;
 for I := 0 to 500000 do
   begin
     str:=IntToStr(i)+MM;
     pp:=Addr(str);
     gg.AddObject(IntToStr(i),TObject(Integer(pp)));
     Self.Button1.Caption :=IntToStr(gg.IndexOf(IntToStr(i)));
   end;

end;

end.

本例程在delphi XE6下通过。

如何使用THashedStringList

标签:

原文地址:http://www.cnblogs.com/China3S/p/5285373.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!