StrLCopy 只是比 StrCopy 多了一个限制长度的参数; StrPCopy 等价于 StrCopy; StrPLCopy 等价于 StrLCopy.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
p: PChar;
begin
p := PChar(StringOfChar(#0, 9));
StrCopy(p, '123456789');
ShowMessage(p); {123456789}
StrLCopy(p, '123456789', 3);
ShowMessage(p); {123}
StrPCopy(p, '123456789');
ShowMessage(p); {123456789}
StrPLCopy(p, '123456789', 3);
ShowMessage(p); {123}
end;
end.
SysUtils 单元下的公用函数目录