str格式,例:'091234'function HexToChar(Str: string): string; var i: integer; buf1: array[0..100] of byte; begin for i := 0 to (length(Str) div 2 - 1) do begin buf1[i] := strtoint('$' + copy(Str, i * 2 + 1, 2)); Result := Result + char(buf1[i]); end; end;function CharToHex(Str: string): string; var i: integer; ch: char; begin for i := 1 to (length(str)) do begin ch := Str[i]; Result := Result + inttohex(byte(ch), 2); end; end;
var
i: integer;
buf1: array[0..100] of byte;
begin
for i := 0 to (length(Str) div 2 - 1) do
begin
buf1[i] := strtoint('$' + copy(Str, i * 2 + 1, 2));
Result := Result + char(buf1[i]);
end;
end;function CharToHex(Str: string): string;
var
i: integer;
ch: char;
begin
for i := 1 to (length(str)) do
begin
ch := Str[i];
Result := Result + inttohex(byte(ch), 2);
end;
end;