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

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


Ïà¹ØÎĵµ£º

Delphi²Ù×÷INIÎļþµÄÒ»°ã²½Öè

Delphi²Ù×÷INIÎļþ²½ÖèÈçÏ£º
-------------------------------------
1£©ÔÚUsesÖÐÌí¼ÓiniFileµ¥Ôª£»
2£©ÉùÃ÷TiniFile¶ÔÏó£»
3£©´´½¨TiniFile¶ÔÏó£»
----------------try------------------
4£©INIÎļþ¶Áд²Ù×÷£»
--------------finally----------------
5£©ÊÍ·ÅTiniFile¶ÔÏó£»
---------------end--------------- ......

delphiÖÐmoveº¯ÊýµÄÓ÷¨

ÎÒÃÇÄÜ¿´µ½ÒÔÏ´úÂë
var pSource,pDest:PChar;
     len: integer;
.......................//һЩ´úÂë
Move(pSource,pDest,len); //´íÎó
Move(pSource^,pDest^,len); //ÕýÈ·
¿´ÆðÀ´È·ÊµºÃÏñÊÇ´«Öµ£¬¶ø²»ÊÇ´«µØÖ·£¬µ«ÊǸ÷λ±ðÍüÁË£¬Õâ²»ÊÇC£¬C++£¬¶øÊÇDelphi
Object Pascal,ËùÒÔ£¬¾ø²»ÄÜ´Óº¯Êýµ ......

ÔÚdelphiÖÐÅжÏ×Ö·û´®ÊÇ·ñÊý×Ö£¬ÒÔ¼°¾«¶È´¦Àíº¯Êý

// ÅжÏÊÇ·ñÊÇÊýÖµÐÍ   By yangxiao  2007.7.21
function isNumeric(strText: WideString): Boolean;
var
  s: string;
  i, l, p: Integer;
begin
  Result := False;
  l := Length(strText);
  if l = 0 then Exit;
  s := '';
  for i:=1 to l do
  ......

delphiÖÐSynchronize

delphiÖÐSynchronizeÕâ¸ö¶«¶«ÓÐʲôÓã¿ÎÒÖªµÀÊÇÏß³Ìͬ²½Ê¹ÓõÄ
ÊÇ·ñÊÇÒ»¸öº¯Êý»ò±äÁ¿£¬µ±Ò»¸öÏß³ÌÔÚʹÓÃʱ£¬Èç¹ûÕâ¸öº¯ÊýʹÓÃÁËSynchronizeÐÞîߵĻ°¾Í²»ÔÊÐí±ðÒ»¸öÏß³ÌÀ´µ÷ÓÃÕâ¸öº¯Êý
1Â¥£º±ðµÄÏ̻߳áµÈ´ý¸Ã²Ù×÷Íê³Éºó²ÅÄܼÌÐø
2Â¥£ºÄã˵µÄ»ù±¾ÊÇÕâ¸öÒâ˼¡£ËüµÄÄ¿µÄÊDZÜÃâ¶à¸ö×ÓÏß³Ìͬʱ·ÃÎÊÖ÷Ïß³Ì×ÊÔ´¡£
ʾÀý£º
......

DelphiÖе÷ÓÃWindows×Ô´øµÄͼƬºÍ´«Õæä¯ÀÀÆ÷

DelphiÖе÷ÓÃWindows×Ô´øµÄͼƬºÍ´«Õæä¯ÀÀÆ÷²é¿´Í¼Æ¬£¬¿ÉÒÔÐýתͼƬҲ¿ÉÒÔµ÷Óû­Í¼³ÌÐò±à¼­Í¼Ïñ¡£×Ô¼ºÐ´²»³öÀ´ºÃµÄ´úÂ룬¾ÍÓÃϵͳ×Ô´øµÄºÃÁË¡£
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,ShellAPI;
type
TForm1 = class(TFo ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ