StrLCat 与 StrCat 类似, StrLCat 多出的参数好像是限制结果的长度.
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  arr: array[0..255] of Char;
begin
  StrCopy(arr, '12345');
  StrCat(arr, 'ABCDEFG');
  ShowMessage(arr); {12345ABCDEFG}
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  arr: array[0..255] of Char;
begin
  StrCopy(arr, '12345');

  StrLCat(arr, 'ABCDEFG', 7);
  ShowMessage(arr); {12345AB}
end;

end.

SysUtils 单元下的公用函数目录

posted on 2008-05-12 22:40  万一  阅读(1878)  评论(1编辑  收藏  举报