-----------------------------------------------------------------------------
Randomize 乱数种子.
-----------------------------------------------------------------------------
Unit System
函数原型 procedure Randomize;
Example
var
I: Integer;
begin
Randomize;
for I := 1 to 50 do begin
{ Write to window at random locations }
Canvas.TextOut(Random(Width), Random(Height), 'Boo!');
end;
end;
##Randomize, Random Example
-----------------------------------------------------------------------------
SizeOf 传回X变数的位元数.
-----------------------------------------------------------------------------
Unit System
函数原型 function SizeOf(X): Integer;
范例 type
CustRec = record
Name: string[30];
Phone: string[14];
end;
var
P: ^CustRec;
begin
GetMem(P, SizeOf(CustRec));
Canvas.TextOut(10, 10, 'The size of the record is ' +
IntToStr(SizeOf(CustRec)));
FreeMem (P, SizeOf(CustRec));
Readln;
end;
-----------------------------------------------------------------------------
Swap 将一组变数的高低位元交换.
-----------------------------------------------------------------------------
Unit System
函数原型 function Swap(X);
范例 var
X: Word;
begin
X := Swap($1234); { $3412 }
end;
-----------------------------------------------------------------------------
UpCase 将一字元转为大写字母.
-----------------------------------------------------------------------------
Unit System
函数原型 function UpCase(Ch: Char): Char;
范例 uses Dialogs;
var
s : string;
i : Integer;
begin
{ Get string from TEdit control }
s := Edit1.Text;
for i := 1 to Length(s) do
s[i] := UpCase(s[i]);
MessageDlg('Here it is in all uppercase: ' + s, mtInformation,
[mbOk], 0);
end;
Example
var
s : string;
i : Integer;
begin
{ Get string from TEdit control }
s := Edit1.Text;
for i := 1 to Length(s) do
if i mod 2 = 0 then s[i] := UpCase(s[i]);
Edit1.Text := s;
end;
===========================================
Ordinal routines 序列常式
==========================================
Dec 使变数递减.
-----------------------------------------------------------------------------
Unit System
函数原型 procedure Dec(var X[ ; N: Longint]);
说明 Dec(X) ==> X:=X-1;
Dec(X,N) ==> X:=X-N;
范例 var
IntVar: Integer;
LongintVar: Longint;
begin
Intvar := 10;
LongintVar := 10;
Dec(IntVar); { IntVar := IntVar - 1 }
Dec(LongintVar, 5); { LongintVar := LongintVar - 5 }
end;
-----------------------------------------------------------------------------
Inc 使变数递增.
-----------------------------------------------------------------------------
Unit System
函数原型 procedure Inc(var X [ ; N: Longint ] );
说明 Inc(X) ==> X:=X-1;
Inc(X,N) ==> X:=X-N;
范例 var
IntVar: Integer;
LongintVar: Longint;
begin
Inc(IntVar); { IntVar := IntVar + 1 }
Inc(LongintVar, 5); { LongintVar := LongintVar + 5 }
end;
Randomize 乱数种子.
-----------------------------------------------------------------------------
Unit System
函数原型 procedure Randomize;
Example
var
I: Integer;
begin
Randomize;
for I := 1 to 50 do begin
{ Write to window at random locations }
Canvas.TextOut(Random(Width), Random(Height), 'Boo!');
end;
end;
##Randomize, Random Example
-----------------------------------------------------------------------------
SizeOf 传回X变数的位元数.
-----------------------------------------------------------------------------
Unit System
函数原型 function SizeOf(X): Integer;
范例 type
CustRec = record
Name: string[30];
Phone: string[14];
end;
var
P: ^CustRec;
begin
GetMem(P, SizeOf(CustRec));
Canvas.TextOut(10, 10, 'The size of the record is ' +
IntToStr(SizeOf(CustRec)));
FreeMem (P, SizeOf(CustRec));
Readln;
end;
-----------------------------------------------------------------------------
Swap 将一组变数的高低位元交换.
-----------------------------------------------------------------------------
Unit System
函数原型 function Swap(X);
范例 var
X: Word;
begin
X := Swap($1234); { $3412 }
end;
-----------------------------------------------------------------------------
UpCase 将一字元转为大写字母.
-----------------------------------------------------------------------------
Unit System
函数原型 function UpCase(Ch: Char): Char;
范例 uses Dialogs;
var
s : string;
i : Integer;
begin
{ Get string from TEdit control }
s := Edit1.Text;
for i := 1 to Length(s) do
s[i] := UpCase(s[i]);
MessageDlg('Here it is in all uppercase: ' + s, mtInformation,
[mbOk], 0);
end;
Example
var
s : string;
i : Integer;
begin
{ Get string from TEdit control }
s := Edit1.Text;
for i := 1 to Length(s) do
if i mod 2 = 0 then s[i] := UpCase(s[i]);
Edit1.Text := s;
end;
===========================================
Ordinal routines 序列常式
==========================================
Dec 使变数递减.
-----------------------------------------------------------------------------
Unit System
函数原型 procedure Dec(var X[ ; N: Longint]);
说明 Dec(X) ==> X:=X-1;
Dec(X,N) ==> X:=X-N;
范例 var
IntVar: Integer;
LongintVar: Longint;
begin
Intvar := 10;
LongintVar := 10;
Dec(IntVar); { IntVar := IntVar - 1 }
Dec(LongintVar, 5); { LongintVar := LongintVar - 5 }
end;
-----------------------------------------------------------------------------
Inc 使变数递增.
-----------------------------------------------------------------------------
Unit System
函数原型 procedure Inc(var X [ ; N: Longint ] );
说明 Inc(X) ==> X:=X-1;
Inc(X,N) ==> X:=X-N;
范例 var
IntVar: Integer;
LongintVar: Longint;
begin
Inc(IntVar); { IntVar := IntVar + 1 }
Inc(LongintVar, 5); { LongintVar := LongintVar + 5 }
end;
情人太累,小姐太贵,友谊交往最实惠 ,没事开开“同学会”,拆散一对算一对!