function Concat(s1 [, s2,..., sn]: string): string;
Description
In Delphi code, use Concat to concatenate an arbitrary number of strings. Each parameter is a string-type expression. The result is the concatenation of all the string parameters.
Using the plus (+) operator has the same effect on two strings as using the Concat function:
S := 'ABC' + 'DEF';
Tip: The plus operator is faster than Concat.
=================================================================
procedure TForm1.Button1Click(Sender: TObject);
var
a,b:string;
begin
a:=edit1.Text;
b:=edit2.Text;
edit3.Text:=concat(a,b);
//function concat(a:string,b:string,c:string..Sn:string):string;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
a,b:pchar;
begin
getmem(a,255); //用到指针函数,你总得分配内存吧
getmem(b,255);
lstrcpy(a,pchar(edit1.Text));
lstrcpy(b,pchar(edit2.Text));
(*
asm
push b
push a
call lstrcat
end;
*)
lstrcat(a,b); //这一句和上面的汇编代码调用的作用是一样的
edit3.text:=strpas(a);
//lstrcat,lstrcpy 都是针对指针操作的API函数
end;