Delphi µÄ×Ö·û¼°×Ö·û´®[
Delphi µÄ×Ö·û¼°×Ö·û´®[1] - string¡¢AnsiString¡¢WideString¡¢String[n]¡¢ShortString
2008-10-17 14:57:17
//×î³£ÓÃµÄ string
var
str: string; {¶¨Òå}
begin
str := 'ÍòÒ»'; {¸³Öµ}
ShowMessage(IntToStr(Length(str))); {³¤¶ÈÊÇ: 4}
end;
//³¤×Ö·û´® AnsiString; ÔÚµ±Ç°°æ±¾(2007)ÖеÄĬÈÏ״̬ÏÂ, String ¾ÍÊÇ AnsiString
var
str: AnsiString;
begin
str := 'ÍòÒ»';
ShowMessage(IntToStr(Length(str))); {³¤¶ÈÊÇ: 4}
end;
//¿í×Ö·û´® WideString (ЧÂʲ»¼° AnsiString)
var
str: WideString;
begin
str := 'ÍòÒ»';
ShowMessage(IntToStr(Length(str))); {³¤¶ÈÊÇ: 2}
end;
//¶¨³¤×Ö·û´®
var
str1: String[6]; {Ö¸¶¨´óС²»Äܳ¬¹ý 255}
str2: String[100];
begin
{ÉÙ¸øÁËÒ²»áÕ¼ÄÇЩÄÚ´æ}
str1 := 'ÍòÒ»';
ShowMessage(str1); {ÍòÒ»}
ShowMessage(IntToStr(Length(str1))); {4; ÕâÊÇ×Ö·û´®µÄ³¤¶È}
ShowMessage(IntToStr(SizeOf(str1))); {7; ÕâÊÇÕ¼ÄÚ´æ´óС}
{¶à¸øÁ˻ᱻ½Ø¶Ï}
str1 := 'ÍòÒ»µÄ Delphi ²©¿Í';
ShowMessage(str1); {ÍòÒ»µÄ}
ShowMessage(IntToStr(Length(str1))); {6; ÕâÊÇʵ¼Ê±£´æµÄ×Ö·û´®³¤¶È}
ShowMessage(IntToStr(SizeOf(str1))); {7; ÕâÊÇÕ¼ÄÚ´æ´óС}
{ÎÊÌâ: ²»ÊÇÉùÃ÷´óСΪ 6 Âð? Ôõô SizeOf ÊÇ 7 ? }
{ÒòΪ¶¨³¤×Ö·û´®»á¶à³öÒ»¸öÊ××Ö½ÚÀ´¼ÇÒä×Ö·û´®µÄʵ¼Ê³¤¶È}
{¾ÙÀý˵Ã÷, Èç¹û¸ø str2 °´Èçϸ³Öµ, ÄÇËüµÄÊ××Ö½Ú(str2[0])¿Ï¶¨´¢´æ×Å×Ö·û 'A'}
str2 := 'iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii'; {65¸ö}
ShowMessage(str2[0]); {A}
ShowMessage(IntToStr(Ord(str2[0]))); {65; ÕâÊÇ 'A' ÔÚ ASCII ÐòÁÐÖеÄÐòºÅ, ÓõľÍÊÇËü}
{ÄÇÒÔºó¿ÉÒÔÓà Ord(str2[0]) À´´úÌæ Length ÅжÏ×Ö·û´®µÄ³¤¶ÈÂð? }
&n
Ïà¹ØÎĵµ£º
3.2 Óû§µÇ¼·½°¸
ÔÚ½øÈëÒ»¸öϵͳʱ£¬±ØÐëÏÈÔڵǼ´°ÌåÖÐÊäÈëÕýÈ·µÄÓû§ÃûºÍÃÜÂë²ÅÄܽøÈë¡£ÕâÑù¿ÉÒÔÈ·±£ÏµÍ³µÄ°²È«ÐԺͱ£ÃÜÐÔ£¬µÇ¼´°ÌåµÄÖÆ×÷°´ÕÕϵͳµÄ´óС¼°Óô¦£¬¿ÉÒÔ·ÖΪ²»Í¬µÄµÇ¼´°ÌåÑùʽ£¬ÔÚϵͳµÚÒ»´ÎµÇ¼ǰ£¬Ê×ÏÈÒª¶Ô²Ù×÷Ô±ÐÅÏ¢½øÐÐÏàÓ¦µÄÉèÖᣱ¾½Ú½«¶ÔµÇ¼´°Ìå¼°²Ù×÷Ô±¹ÜÀí´°ÌåµÄÖÆ×÷¹ý³Ì½øÐÐÏêϸµÄ˵Ã÷ ......
Delphi²Ù×÷×¢²á±í²½ÖèÈçÏ£º
-------------------------------------
1£©ÔÚUsesÖÐÌí¼ÓRegistryµ¥Ôª£»
2£©ÉùÃ÷TRegistry¶ÔÏó£»
3£©´´½¨TRegistry¶ÔÏó£»
4£©Ö¸¶¨¸ù¼ü£»
----------------try------------------
5£©´ò¿ªÐèÒª²Ù×÷µÄÖ÷¼ü£»
6£©¶Áд²Ù×÷£»
7£©±£´æ²¢¹Ø±ÕÖ÷¼ü£»
--------------finally----------------
......
Ò»¡¢Ê¹ÓÃÎļþÁ÷µÄ·½·¨½øÐп½±´£¬µ±È»¡£Í¬ÑùµÄµÀÀí£¬ÄãÒ²¿ÉÒÔʹÓÃÄÚ´æÁ÷µÈ·½·¨½øÐÐÎļþµÄ¿½±´£¬ÔÀíÊÇÒ»ÑùµÄ¡£
procedure copyfile(sourcefilename,targetfilename : String);
var f1, f2: tfilestream;
begin
f1 := tfilestream.Create(sourcefilename, fmopenread);
try
f2 := tfilestream ......
Delphi¿½±´Ä¿Â¼(º¬×ÓĿ¼)µÄ·½·¨
ҪʵÏÖĿ¼¼¶µÄ¿½±´£¬¿ÉÒÔÀûÓÃWindows APIº¯ÊýShFileOperation( )£¬Æ亯ÊýÉùÃ÷ÈçÏ£º
WINSHELLAPI int WINAPI SHFileOperation(
LPSHFILEOPSTRUCT lpFileOp
);
ʵÀý£º
н¨Ò»¸ö¹¤³Ì£¬Æä³ÌÐòʾÀýÈçÏ£º
unit Unit1;
interface
uses
Windows, Messag ......
Ò»ÌáÆð»ùÓÚWeb Services¼¼ÊõµÄÓ¦ÓóÌÐò¿ª·¢£¬Ò»°ãÈËÊ×ÏÈÏëµ½µÄ¿ª·¢¹¤¾ßÊÇVs.net£¬Æäʵ×÷Ϊ¿ìËÙÓ¦ÓóÌÐò¿ª·¢¹¤¾ß(RAD)µÄÀÏ´ó£¬Delphi´Ó6.0¾Í¿ªÊ¼Ö§³ÖWeb ServicesµÄ¿ª·¢ºÍÓ¦ÓÃÁË£¬±¾ÎÄͨ¹ýʹÓÃDelphi 7.0µ÷ÓÃÐÂÀË·¢ËͶÌÐŵÄWeb Service½øÐжÌÐÅÓ¦ÓóÌÐò¿ª·¢ÕâһʵÀýÏêϸµÄ½éÉÜÔÚDelphiÖÐÈçºÎ¿ª·¢»ùÓÚWeb ServicesµÄÓ¦ÓÃϵͳ¡ ......