作者:admin 来源: 日期:2020/2/24 19:09:46 人气: 标签:
string字符串转换Byte[]字节数组
procedure TForm1.Button1Click(Sender: TObject);var s:string; P:PChar; B:array of Byte;begin s:='Hello'; SetLength(B,Length(S)+1); P:=PChar(S); CopyMemory(B,p,Length(S)+1); Showmessage(Char(B[0]));end;procedure TForm1.Button1Click(Sender: TObject);var s:string; ab:array of byte; i:integer;begin s:='this is a test'; SetLength(ab,Length(s)); for i:=1 to length(s) do ab[i]:=byte(s[i]);end; b: array[1..7] of byte;
s: string;
SetLength(s, 7);
Move(b[1],s[1], 7 );
完美转换
来源:https://blog.csdn.net/xyzhan/article/details/87269775