Ë˵DelphiûÓйþÏ£
Ë˵DelphiûÓйþÏ££¿££DelphiÖУ¬TStringListºÍTHashedStringListµÄÐÔÄܶԱÈ
Ôø¾¿´µ½ºÜ¶àÈËÔÚÈÂÈÂDelphiûÓйþÏ£±í£¬ÕâЩÈ˵͝ÊÖÒâʶ¹ÃÇÒ²»ÂÛ£¬È´»¹ÓкܶàÈËÒÔ´ËÀ´Ö¤Ã÷Delphi±È±ðµÄÓïÑÔÀ¬»ø£¬ÊµÔÚÊÇ...
ºÃ£¬ÀÎɧ´òס£¬×ª½ÓÕýÌâ¡£
TStringListÊÇÎÒÃdz£ÓõÄ×Ö·û´®ÁбíÀàÐÍ£¬Ó÷¨¾Í²»ÔÚÕâÀï׸Êö£¬µ«ÊÇ£¬ÔÚÊý¾ÝÆäÏîÊýÔö¶àʱ£¬ÆäËÑË÷£¨Ö÷ÒªÊÇname/keyËÑË÷ºÍindexofËÑË÷£©ÐÔÄܻἱ¾çϽµ£¬ÔÒòÊÇTStringListµÄÄÚ²¿´æ´¢Ê¹ÓÃÁËÁ´±íÐÎʽ£¬¶øËÑË÷²Ù×÷ʹÓÃÁËÑ»·±éÀú·½Ê½¡£
ÖµµÃ¸ßÐ˵ÄÊÇ£¬ÔÚiniFilesµ¥Ôª£¬DelphiΪÎÒÃÇÌṩÁËTHashedStringListÀàÐÍ£¬¼´£¬¾¹ý¹þÏ£´¦ÀíµÄTStringList£¬Ëü¼Ì³Ð×ÔTStringList£¬Ö»ÊǶÔËÑË÷·½·¨½øÐÐÁËÓÅ»¯£¬Òò´Ë£¬ÎÒÃÇÍêÈ«¿ÉÒÔ·ÅÐĵÄÔÚ´óÁ¿×Ö·û´®ËÑË÷µÄʱºòʹÓÃËüÀ´´úÌæTStringList£¬¶øÐèÒª¸Ä±äµÄÖ»ÊÇÔÚ:=µÄºóÃæÓÃTHashedStringList.createÀ´´úÌæTStringList.create£¬µ«ÆäËÙ¶ÈÈ´Ìá¸ßÁËÒ»¸öÊýÁ¿¼¶¡£
ΪÁËÏÔʾÁ½Õß¼äÐÔÄܵIJî¾à£¬ÎÒдÁ˼¸¸ö¼òµ¥µÄÓï¾äÀ´²âÊÔËûÃǸ÷×ÔµÄÌØÐÔ¡£
unit ufrmMainForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, StrUtils,IniFiles;
type
TForm1 = class(TForm)
btn1: TButton;
mmo1: TMemo;
procedure btn1Click(Sender: TObject);
private
...{ Private declarations }
public
procedure testTHashStringList;
procedure testTStringList;
...{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses DateUtils;
...{$R *.dfm}
procedure TForm1.btn1Click(Sender: TObject);
begin
testTStringList;
mmo1.Lines.Add('--------------------');
testTHashStringList;
end;
procedure TForm1.testTHashStringList;
var
hsl: THashedStrin
Ïà¹ØÎĵµ£º
ûÓÐÓ¦ÓÃ״̬ģʽµÄ´úÂë
1. ¹¤³ÌÎļþ
program Project1;
{$APPTYPE CONSOLE}
uses
uGumballMachine in 'uGumballMachine.pas';
var
aGumballMachine: TGumballMachine;
begin
aGumballMachine := TGumballMachine.Create(5);
aGumballMachine.InsertQuarter;
aGumballMachine.TurnCrank;
Writeln; ......
@·ûºÅ·µ»ØÒ»¸ö±äÁ¿µÄµØÖ·
Àý£º
var
f:string;
p:^string; //ÉùÃ÷Ò»¸ö×Ö·û´®ÀàÐ͵ÄÖ¸Õë
begin
f ='demo'; ......
Ò»¡¢ÕûÊýÀàÐÍ
ÀàÐÍ ËùÕ¼×Ö½ÚÊý ȡֵ·¶Î§
byte 1 0-255
word 2 0-65535
shortint 1 -128-127
smallint 2 -32768-32767
integer 4 -214748648-214748467
longint 4 -214748648-214748467
cordinal 4 0-2147483647
¶þ¡¢ÊµÊýÀàÐÍ
ÀàÐÍ Ëùµã×Ö½ÚÊý ȡֵ·¶Î§
Real 6 ±2.9×10µÄ¸º39´Î·½µ½1.7× ......
Ãû³Æ ÀàÐÍ ËµÃ÷
abort º¯Êý ÒýÆð·ÅÆúµÄÒâÍâ´¦Àí
abs º¯Êý ¾ø¶ÔÖµº¯Êý
addexitproc º¯Êý ½«Ò»¹ý³ÌÌí¼Óµ½ÔËÐÐʱ¿âµÄ½áÊø¹ý³Ì±íÖÐ
addr º¯Êý ·µ»ØÖ¸¶¨¶ÔÏóµÄµØÖ·
adjustlinebreaks º¯Êý ½«¸ø¶¨×Ö·û´®µÄÐзָô·ûµ÷ÕûΪcr/lfÐòÁÐ
align ÊôÐÔ Ê¹¿Ø¼þλÓÚ´°¿Úij²¿·Ö
alignment ÊôÐÔ ¿ ......
ÔÀ´ÊÇÒªÔÚFormCreateÖмÓÈëÒÔÏ´úÂë:
procedure TTntForm1.TntFormCreate(Sender: TObject);
begin
//Õâ¾äºÜ¹Ø¼ü.¶ÔÓÚÆ½Ì¨µÄÖ§³Ö.
if Win32Platform = VER_PLATFORM_WIN32_NT then
Font.Name := 'MS Shell Dlg 2'
else
Font.Name := 'MS Shell Dlg';
......