以下就可! function HexToAsc(SourceStr: string; isTrim: Boolean = True): string; //十六进制换成Ascii码 var i: Integer; tmpstr, tmpstr1: string; begin if SourceStr <> '' then begin // Result := Chr(StrToInt('$' + SourceStr)); if isTrim then SourceStr := trim(SourceStr); for i := 0 to (Length(SourceStr) div 2 - 1) do begin tmpstr := SourceStr; delete(tmpstr, 1, i * 2); delete(tmpstr, 3, 100); tmpstr1 := Chr(StrToInt('$' + tmpstr)); //IntToHex(Ord(tmpstr[1]), 0); Result := Result + tmpstr1; end; end; end;
我以前作过,好象m 的立方等都一样.
function HexToAsc(SourceStr: string; isTrim: Boolean = True): string;
//十六进制换成Ascii码
var
i: Integer;
tmpstr, tmpstr1: string;
begin
if SourceStr <> '' then
begin
// Result := Chr(StrToInt('$' + SourceStr)); if isTrim then
SourceStr := trim(SourceStr);
for i := 0 to (Length(SourceStr) div 2 - 1) do
begin
tmpstr := SourceStr;
delete(tmpstr, 1, i * 2);
delete(tmpstr, 3, 100);
tmpstr1 := Chr(StrToInt('$' + tmpstr)); //IntToHex(Ord(tmpstr[1]), 0);
Result := Result + tmpstr1;
end;
end;
end;