其他分享
首页 > 其他分享> > SysUtils.StrLCopy、SysUtils.StrPCopy、SysUtils.StrPLCopy

SysUtils.StrLCopy、SysUtils.StrPCopy、SysUtils.StrPLCopy

作者:互联网

SysUtils.StrLCopy、SysUtils.StrPCopy、SysUtils.StrPLCopy

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 单元下的公用函数目录

posted on 2008-05-12 21:23  万一  阅读(5079)  评论(0)  编辑  收藏

标签:StrPLCopy,StrLCopy,StrPCopy,SysUtils,123456789,ShowMessage
来源: https://blog.51cto.com/u_14617575/2746266