Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

DelphiÖеÄTHashTable

ÔÚDelphiÖÐ,Inifilesµ¥ÔªÖÐÓÐÒ»¸öTStringHashµÄÀ࣬²»¹ýËüµÄValue½öÖ§³ÖInteger(ÆäʵҲ²»ÊÇÎÊÌ⣬ÓÐÆäËüÀàÐÍ¿ÉÒÔ½«±äÁ¿±äΪPointer)£¬ÓÐµã²»Êæ·þ£¬½ñÌìûÊÂ×ö¾Í°ÑËüÌæ»»ÎªvariantÁË£¬ÆäÖÐKeyµÄÃû³Æ´óСдÎ޹أ¬¾ÍÊÇΪÁ˼ӿ쿪·¢ËÙ¶È£¡
ʹÓÃHashtable,²éÕÒºÍɾ³ý¸´ÔӶȶ¼Êdz£Êý¼¶±ðµÄ!
type
PPHashItem = ^PHashItem;
PHashItem = ^THashItem;
THashItem = record
Next: PHashItem;
Key: String;
Value: Variant;
end;
THashTable = class
private
Buckets: array of PHashItem;
protected
function Find(const Key: String): PPHashItem;
function HashOf(const Key: String): Cardinal; virtual;
public
constructor Create(Size: Cardinal = 256);
destructor Destroy; override;
procedure Put(const Key: String; Value: Variant);
procedure Clear;
procedure Remove(const Key: String);
function Modify(const Key: String; Value: Variant): Boolean;
function Get(const Key: String): Variant;
function ContainKey(const Key: String):boolean;
end;
procedure THashTable.Clear;
var
I: Integer;
P, N: PHashItem;
begin
for I := 0 to Length(Buckets) - 1 do
begin
P := Buckets[I];
while P <> nil do
begin
N := P^.Next;
Dispose(P);
P := N;
end;
Buckets[I] := nil;
end;
end;
function THashTable.ContainKey(const Key: String): boolean;
var
P: PHashItem;
begin
P := Find(Key)^;
if P <> nil then
begin
Result := True;
end
else
Result := False;
end;
constructor THashTable.Create(Size: Cardinal);
begin
inherited Create;
SetLength(Buckets, Size);
end;
destructor THashTable.Destroy;
begin
Clear;
inherited Destroy;
end;
function THashTable.Find(const Key: String): PPHashItem;
var
Hash: Integer;
begin
Hash := HashOf(Key) mod Cardinal(Length(Buckets));
Result := @Buckets[Hash];
while Result^ <> nil do
begin
if Result^.Key = Key then
Exit
else
Result := @Result^.Next;
end;
end;
functio


Ïà¹ØÎĵµ£º

¡¾×ª¡¿delphi¶ÁдtxtÎļþ

http://meidi152.blog.163.com/blog/static/5423302009610103610744/
 
1. memo¿Ø¼þ¶ÁÈ¡txt
memo1.Lines.LoadfromFile('E:\*\*.txt');
2.
Procedure NewTxt(FileName:String);
Var
F : Textfile;
Begin
if fileExists(FileName) then DeleteFile(FileName); {¿´ÎļþÊÇ·ñ´æÔÚ,ÔÚ¾Í刪³ý}
AssignFile(F, ......

Delphi¿ç½ø³Ì·ÃÎÊDBGRID

´ËÎÄÊǸù¾Ý°éË®ÀÏ´óµÄʵÀý×öµÄСÐ޸ģ¡
ÒÔÏÂÊǸöÈ˼û½â£¬ÈçÓдíÎóÇëÖ¸Õý:)
      ÒªÏë¿ç½ø³Ì·ÃÎÊDBGRID£¬Ã²ËÆÖ»ÄÜÓÃHOOK£¬Ð´Ò»¸öDLLÏë°ì·¨×¢È뵽Ŀ±ê½ø³Ì¡£×¢Èë³É¹¦ºó£¬Ê¹DLLÓëÄ¿±ê½ø³ÌÔÚͬһ½ø³Ì¿Õ¼äÖÐ(ÆäÄÚÓÐһЩϸ½ÚÎÊÌ⣬Çë²Î¼û´úÂë)£¬Õâʱ¿ÉÒÔ·ÃÎÊÄ¿±ê½ø³ÌµÄVCL×é¼þ¡£²¢°ÑVCL×é¼þµÄÊý¾Ýͨ¹ ......

delphi×Ö·û´®×ª»»ÎªcharÊý×é

var
  arrChar : array [0..4] of Char;
  b : Byte;
  s : string;
begin
  s := 'Test';
  Move(Pointer(s)^, arrChar, Length(s));   //string to array of char
  ShowMessage(arrChar);
  b := Ord(s[1]);   //First byte string to one single byte ......

delphiÓësqlite




from : http://zhyhero.googlepages.com/heartset
file:0 ǰÑÔ
       ±¾ÎĵÄÄ¿µÄÔÚÓÚ²ÉÓÃÁ÷Ë®ÕË·½Ê½À´¼Ç¼ѧϰdelphi·ÃÎÊǶÈëʽÊý¾Ý¿âsqliteÖеÄһЩµãµÎ¡£»¶Ó­¸÷λͬºÃ¹²Í¬Ñ§Ï°ºÍÅúÆÀÖ¸Õý¡£
file:1 ×¼±¸¹¤×÷part1
 & ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ