16,749
社区成员
发帖
与我相关
我的任务
分享
function HexStringToArray(const S: string): TByteArray;
var
i: integer;
begin
SetLength(Result, Length(S) div 2);
for i := 0 to High(Result) do
try
Result[i] := StrToInt('$' + Copy(S, Low(S) + i * 2, 2));
except
Raise;
end;
end;
然后SendBuf返回的array就可以了。
var
Str: String;
Str_Temp: String;
i: Integer;
n_Leng: Integer;
A_Str: Array of String;
begin
Str:= '55AA0000010100D90000000000000000000000002564697370303AC7EB41303032B5BD32BAC5B4B0BFDA00000D0A';
Str_Temp:= '';
n_Leng := Length(Str) div 2;
SetLength( A_Str, n_Leng );
for i:=1 to n_Leng do
begin
A_Str[i-1] := '$' + Copy( Str, (i-1)*2+1, 2 );
Str_Temp:= Str_Temp + A_Str[i-1] + ' ';
end;
Lbl_1.Caption := Str_Temp;
end;