Delphi formatµÄÓ÷¨
Ò»¡¢Formatº¯ÊýµÄÓ÷¨
FormatÊÇÒ»¸öºÜ³£Óã¬È´ÓÖËƺõºÜ·³µÄ·½·¨£¬±¾ÈËÊÔͼ¶ÔÕâ¸ö·½·¨µÄ°ïÖú½øÐÐһЩ·Ò룬ÈÃËüÓÐÒ»¸öÍêÕûµÄ¸Åò£¬ÒÔ¹©´ó¼Ò²éѯ֮Óãº
Ê×ÏÈ¿´ËüµÄÉùÃ÷£º
function Format(const Format: string; const Args: array of const): string; overload;
ÊÂʵÉÏFormat·½·¨ÓÐÁ½¸öÖÖÐÎʽ£¬ÁíÍâÒ»ÖÖÊÇÈý¸ö²ÎÊýµÄ£¬Ö÷ÒªÇø±ðÔÚÓÚËüÊÇḬ̈߳²È«µÄ£¬µ«²¢²»¶àÓã¬ËùÒÔÕâÀïÖ»¶ÔµÚÒ»¸ö½éÉÜ£º
function Format(const Format: string; const Args: array of const): string; overload;
Format²ÎÊýÊÇÒ»¸ö¸ñʽ×Ö·û´®£¬ÓÃÓÚ¸ñʽ»¯ArgsÀïÃæµÄÖµµÄ¡£ArgsÓÖÊÇʲôÄØ£¬ËüÊÇÒ»¸ö±äÌåÊý×飬¼´ËüÀïÃæ¿ÉÒÔÓжà¸ö²ÎÊý£¬¶øÇÒÿ¸ö²ÎÊý¿ÉÒÔ²»Í¬¡£
ÈçÒÔÏÂÀý×Ó£º
Format('my name is %6s',['wind']);
·µ»Øºó¾ÍÊÇ
my name is wind
ÏÖÔÚÀ´¿´Format²ÎÊýµÄÏêϸÇé¿ö£º
FormatÀïÃæ¿ÉÒÔдÆÕͨµÄ×Ö·û´®£¬±ÈÈç'my name is' µ«ÓÐЩ¸ñʽָÁî×Ö·û¾ßÓÐÌØÊâÒâÒ壬±ÈÈç"%6s"
¸ñʽָÁî¾ßÓÐÒÔϵÄÐÎʽ£º
"%" [index ":"] ["-"] [width] ["." prec] type
ËüÊÇÒÔ"%"¿ªÊ¼,¶øÒÔtype½áÊø£¬type±íʾһ¸ö¾ßÌåµÄÀàÐÍ¡£ÖмäÊÇÓÃÀ´¸ñʽ»¯typeÀàÐ͵ÄÖ¸Áî×Ö·û£¬ÊÇ¿ÉÑ¡µÄ¡£
ÏÈÀ´¿´¿´type,type¿ÉÒÔÊÇÒÔÏÂ×Ö·û£º
d Ê®ÖÆÊý£¬±íʾһ¸öÕûÐÍÖµ
u ºÍdÒ»ÑùÊÇÕûÐÍÖµ£¬µ«ËüÊÇÎÞ·ûºÅµÄ£¬¶øÈç¹ûËü¶ÔÓ¦µÄÖµÊǸºµÄ£¬Ôò·µ»ØʱÊÇÒ»¸ö2µÄ32´Î·½¼õÈ¥Õâ¸ö¾ø¶ÔÖµµÄÊý
È磺Format('this is %u',[£2]);
·µ»ØµÄÊÇ£ºthis is 4294967294
f ¶ÔÓ¦¸¡µãÊý
e ¿Æѧ±íʾ·¨£¬¶ÔÓ¦ÕûÐÍÊýºÍ¸¡µãÊý£¬
±ÈÈçFormat('this is %e',[-2.22]);
·µ»ØµÄÊÇ£ºthis is -2.22000000000000E+000
µÈÒ»ÏÂÔÙ˵Ã÷Èç¹û½«ÊýµÄ¾«¶ÈËõС
g Õâ¸öÖ»ÄܶÔÓ¦¸¡µãÐÍ£¬ÇÒËü»á½«ÖµÖжàÓàµÄÊýÈ¥µô
±ÈÈçFormat('this is %g',[02.200]);
·µ»ØµÄÊÇ£ºthis is 2.2
n Ö»ÄܶÔÓ¦¸¡µãÐÍ£¬½«Öµ×ª»¯ÎªºÅÂëµÄÐÎʽ¡£¿´Ò»¸öÀý×Ó¾ÍÃ÷°×ÁË
Format('this is %n',[4552.2176]);
·µ»ØµÄÊÇthis is 4,552.22
×¢ÒâÓÐÁ½µã£¬Ò»ÊÇÖ»±íʾµ½Ð¡ÊýºóÁ½Î»£¬µÈÒ»ÏÂ˵ÔõôÏû³ýÕâÖÖÇé¿ö
¶þÊÇ£¬¼´Ê¹Ð¡ÊýûÓб»½Ø¶Ï£¬ËüÒ²²»»áÒ²ÏñÕûÊý²¿·ÖÒ»ÑùÓжººÅÀ´·Ö¿ªµÄ
m Ç®±ÒÀàÐÍ£¬µ«¹ØÓÚ»õ±ÒÀàÐÍÓиüºÃµÄ¸ñʽ»¯·½·¨£¬ÕâÀïÖ»ÊǼòµ¥µÄ¸ñʽ»¯
ÁíÍâËüÖ»¶ÔÓ¦ÓÚ¸¡µãÖµ
Format('this is %m',[9552.21]);
·µ»Ø£º
Ïà¹ØÎĵµ£º
Windows ÏÂÒ»¸öµäÐ͵ÄÌØÕ÷¾ÍÊǶàÈÎÎñ£¬ÎÒÃÇ¿ÉÒÔͬʱ´ò¿ª¶à¸ö´°¿Ú½øÐвÙ×÷£¬Ò²¿ÉÒÔͬʱÔËÐгÌÐòµÄ¶à¸öʵÀý£¬±ÈÈç¿ÉÒÔ´ò¿ªÐí¶à¸ö×ÊÔ´¹ÜÀíÆ÷½øÐÐÎļþµÄÒƶ¯¸´ÖƲÙ×÷¡£µ«ÓÐʱ³öÓÚijÖÖ¿¼ÂÇ£¨±ÈÈ簲ȫÐÔ£©£¬ÎÒÃÇÒª×ö³öһЩÏÞÖÆ£¬ÈóÌÐòÖ»Äܹ»ÔËÐÐÒ»¸öʵÀý¡£ÔÚDelphi±à³ÌÖУ¬±ÊÕß×ܽá³öÁËÒÔϼ¸ÖÖ·½·¨£º
¡¡¡¡Ò»¡¢ ²éÕÒ´°¿Ú·¨
¡¡¡ ......
{-----------------------------------------------------------------------------
Unit Name: HashTable
Author: LiuHeng
Date: 2010-04-13
Purpose: ·â×°DelphiµÄHashTable
History:
------------------------------- ......
תÔØ×Ô£ºhttp://www.cnblogs.com/jdmei520/archive/2009/06/17/1505053.html
Webservice¼¼ÊõµÄ³öÏÖ½«¸÷ÖÖ¿ª·¢¼¼ÊõºÍÓïÑÔÍêÈ«µÄÈÚºÏÁË£¬ÏÂÃæ¾ÍÕâÖÖÈÚºÏÔÚC#ºÍdelphiÖ®¼äµÄ½»»¥×öÒ»´ÎÈ«ÃæµÄÌåÏÖ
1.ʹÓÃC#´´½¨Ò»¸öWebservice·þÎñ¡£
ʹÓÃvs2005µÄÄ£°å´´½¨C#µÄwebservice·Ç³£ÈÝÒס£ÔÎļþÈçÏÂ:
[WebService(Namespace  ......
[code=Delphi(Pascal)]
unit uThreadPool;
{ aPool.AddRequest(TMyRequest.Create(RequestParam1, RequestParam2, ...)); }
interface
uses
Windows,
Classes;
// ÊÇ·ñ¼Ç¼ÈÕÖ¾
// {$DEFINE NOLOGS}
type
TCriticalSection = class(TObject)
protected
FSec ......
delphiµ÷ÓÃÑ¡ÔñĿ¼¶Ô»°¿ò
¾³£¼ûÍøÉÏÓÐÈËÎÊÑ¡ÔñĿ¼¶Ô»°¿òµÄ¿Ø¼þ£¬ÆäʵֻÓÃÒ»¸öº¯Êý¾Í¿ÉÒÔʵÏÖ¡£
×¢ÒâÒýÓÃ Filectrl µ¥Ôª
use Filectrl;
procedure TForm1.Button1Click(Sender: TObject);
var
Dir: String;
begin
SelectDirectory('Select a directory', '', Dir);
ShowMessage(Dir);
end; ......