move

procedure TForm1.Button1Click(Sender: TObject);
var
s, b: AnsiString;
a: array[0..9] of Byte;
begin
s := 'test';
FillChar(a, SizeOf(a), '');
Move(s[1], a, SizeOf(a));
SetLength(b, SizeOf(a) + 1);
Move(a, b[1], SizeOf(a));
Caption := b;
end;

原文地址:https://www.cnblogs.com/hnxxcxg/p/2772295.html