- //字符串转为16进制
- function StrToHex(AStr: String): String;
- var
- i : Integer;
- begin
- Result := '';
- for i := 1 to Length(AStr) do
- Result := Result + IntToHex(ord(AStr[i]), 2);
- end;
- //16进制转为字符串
- function HexToStr(AHex: String): String;
- var
- i : Integer;
- begin
- Result := '';
- for i := 1 to Length(AHex) div 2 do
- Result := Result + chr(StrToInt('$' + copy(AHex, i * 2 - 1, 2)));
- end;