Delphi ¾¿¾¹²úÉúÁ˼¸¸öString¶ÔÏóµÄÎÊÌâ
¼¼Êõ½»Á÷,DH½²½â. Õâ¸öÊÇÔÚCSDNÉÏÃæ¿´¼ûµÄÎÊÌâ.ÎÒ˵˵×Ô¼ºµÄÏë·¨. procedure TForm1.btn1Click(Sender: TObject);
var
Str:String;
begin
Str:='abc' ;
Str:=str+'d';
str:=copy(Str,1,3);
str:=UpperCase(str);
end;
ÎÊÌâ1´ð°¸:2010ÏÂ
Unit4.pas.29: begin
005144E0 55 push ebp
005144E1 8BEC mov ebp,esp
005144E3 6A00 push $00
005144E5 6A00 push $00
005144E7 33C0 xor eax,eax
005144E9 55 push ebp
005144EA 6856455100 push $00514556
005144EF 64FF30 push dword ptr fs:[eax]
005144F2 648920 mov fs:[eax],esp
Unit4.pas.30: Str:='abc' ;
005144F5 8D45FC lea eax,[ebp-$04]
005144F8 BA70455100 mov edx,$00514570 //Õâ¿éÄÚ´æÖдæ·ÅµÄÊÇ abc ×Ö·û´®¶ÔÏó
005144FD E8E631EFFF call @UStrLAsg //¸ú½øÕâ¸öº¯Êý,ÓÉÓÚabc¿é´¦±¾À´¾ÍÊÇUnicodeµÄ,ËùÒÔ²»ÐèҪת»»,Ö»ÊÇÒýÓôÎÊý¼ÓÒ»,Ò²¾ÍÊÇÕâÀïÊÇ ±àÒëÆ÷Ò»¿ªÊ¼¾Í²úÉúÁËÒ»¸ö abc ×Ö·û´®¶ÔÏó
Unit4.pas.32: Str:=str+'d';
00514502 8D45FC lea eax,[ebp-$04]
00514505 BA84455100 mov edx,$00514584 //ÀàËÆÕâÀïÊÇÒ»¸ö'd'µÄ×Ö·û´®¶ÔÏó,×ܹ²³öÏÖ2¸öÁË
0051450A E8A935EFFF call @UStrCat //»á¶Ôµ÷ÓÃUStrSetLength,eaxÊÇabcµØÖ·,edxÊÇ4,Ò²¾ÍÊÇÏȸøabcÀ©ÈÝ,¶øÕâ¸öº¯ÊýÀïÃæµ÷ÓÃÁËNewUnicodeString,»áвúÉúÒ»¸öabc×Ö·û´®¶ÔÏó¿Õ¼ä,È»ºóÔÚÕâ¸ö¶ÔÏó¿Õ¼äÉÏÓÃmov°ÑdÒƵ½abcÉÏÈ¥,ÐγÉabcd,µ½ÏÖÔÚ³öÏÖÁË3¸ö×Ö·û´®¶ÔÏóÁË.
Unit4.pas.34: str:=copy(Str,1,3);
0051450F 8D45FC lea eax,[ebp-$04] //´ÓÕâÒ»¾äÎÒÃÇÒ²¿ÉÒÔ¿´¼û¾Ö²¿±äÁ¿µÄÖ¸ÕëÒ²¸Ä±äλÖÃÁË
00514512 50 push eax
00514513 B903000000 mov ecx,$00000003
00514518 BA01000000 mov edx,$00000001
0051451D 8B45FC mov eax,[ebp-$04]
00514520 E8BF38EFFF call @UStrCopy //ÏÈÔö¼ÓÒ»´Î±»¸´ÖÆ×Ö·û´®µÄÒýÓôÎÊý,È»ºóÔÚUStrfromPWCharLenÖе÷ÓÃNewUnicodeStringÉêÇëÒ»¸ö¿Õ¼äΪ3µÄ×Ö·û´®¶ÔÏó,µØÖ·$00F2e02c,µÚ4¸öÁËÓ´,×îºóÉèÖúÃÆ«Òƺó,ÓÃMovº¯Êý½«abcÒƵ½Õâ¸ö¿Õ¼äÈ¥
Unit4.pas.36: str:=UpperCase(str);
00514525 8D55F8 lea edx,[ebp-$08] //Õâ¸öµØÖ·ÀïÃæÊÇʲô?Ó¦¸ÃÊÇ·
Ïà¹ØÎĵµ£º
£®pas ---- pascalµÄËõд, µ¥ÔªÔʼ³Ìʽµµ£¨ unit source files £©
£®dpr ---- ר°¸µµ ( project files )
£®dpk ---- °ü¹üÔʼ³Ìʽµµ/×é¼þ°ü ( package source files )
£®dfm ---- ±íµ¥µµ (¼Ç¼formµÄÄÚÈÝ,³ýÈ¥Õâ¸öÄÚÈݾ͵ÈÓÚɾ³ýÁËformÕâ¸ö±íµ¥)
£®dcu ---- ÊDZàÒëºÃµÄµ¥ÔªÎļþ.ÈôÖ»ÓÐÒ»¸ödcuÎļþ,Ôò²»ÄÜ¿´µ½Ô´´úÂë.
......
½üÀ´·¢ÏÖÒ»¸öDelphiĪÃûÆäÃîµÄbug£¬µ±Ê¹ÓÃSetOptionalParamʱ£¬²»ÄÜʹÓÃÒ»Á¬´®Êý×ÖµÄ×Ö·û´®£¬Èç'101'£¬×¢Ò⣬ÊÇ´øÒýºÅµÄ¡£ÔÚSaveToFileʱ£¬¾Í»á³öÏÖ'Invalid field type'µÄÒì³££¬ÕæÊÇ°Ù˼²»µÃÆä½â£¡Á¬'001'ÕâÖÖ´®Ò²²»ÐУ¬È¥µôÒýºÅ£¬Ö±½Ó°´Êý×Ö¸³Öµ£¬ÔòÕý³£¡£
procedure TForm1.Button1Click(Sender: TObject);
var
  ......
DelphiÖÐʵÏÖÈ«½Çת°ë½Ç
function SbctoDbc(s:string):string;
var
nlength,i:integer;
str,ctmp,c1,c2:string;
{
ÔÚwindowsÖУ¬ÖÐÎĺÍÈ«½Ç×Ö·û¶¼Õ¼Á½¸ö×Ö½Ú£¬
²¢ÇÒʹÓÃÁËascii¡¡chart 2
(codes 128 - 255
)¡£
È«½Ç×Ö·ûµÄµÚÒ»¸ö×Ö½Ú×ÜÊÇ ......
Delphi¼üÅÌ°´¼üαÂë
Ó÷¨£ºif key = chr(VK_RETURN) then...
³£ÊýÃû³Æ Ê®Áù½øÖÆÖµ Ê®½øÖÆÖµ ¶ÔÓ¦°´¼ü
VK_LBUTTON 01 1 Êó±êµÄ×ó¼ü
VK_RBUTTON 02 2 Êó±êµÄÓÒ¼ü
VK-CANCEL 03 3 Contol-break Ö´ÐÐ
VK_MBUTTON 04 4 Êó±êµÄÖмü£¨Èý°´¼üÊó±ê)
VK_BACK 08 8 Backspace¼ü
VK_TAB 09 9 Tab¼ü
VK_CLEAR 0C 12 Clear¼ü
VK ......