function HexToStr(mHex: string): string; var I: Integer; begin Result := ''; for I := 1 to Length(mHex) div 2 do if IsInteger('$' + mHex[I * 2 - 1] + mHex[I * 2]) then Result := Result + Chr(StrToInt('$' + mHex[I * 2 - 1] + mHex[I * 2])); end; { HexToStr }function StrToHex(mStr: string): string; var I: Integer; begin Result := ''; for I := 1 to Length(mStr) do Result := Result + IntToHex(Ord(mStr[I]), 2); end; { StrToHex }
function HexToStr(mHex: string): string; var I: Integer; begin Result := ''; for I := 1 to Length(mHex) div 2 do if IsInteger('$' + mHex[I * 2 - 1] + mHex[I * 2]) then Result := Result + Chr(StrToInt('$' + mHex[I * 2 - 1] + mHex[I * 2])); end; { HexToStr }function StrToHex(mStr: string): string; var I: Integer; begin Result := ''; for I := 1 to Length(mStr) do Result := Result + IntToHex(Ord(mStr[I]), 2); end; { StrToHex }
我试了一下,发现str:=IntToHex(ord('a'),2);后
str=‘’
怎么回事??
var
I: Integer;
begin
Result := '';
for I := 1 to Length(mHex) div 2 do
if IsInteger('$' + mHex[I * 2 - 1] + mHex[I * 2]) then
Result := Result + Chr(StrToInt('$' + mHex[I * 2 - 1] + mHex[I * 2]));
end; { HexToStr }function StrToHex(mStr: string): string;
var
I: Integer;
begin
Result := '';
for I := 1 to Length(mStr) do Result := Result + IntToHex(Ord(mStr[I]), 2);
end; { StrToHex }
var
I: Integer;
begin
Result := '';
for I := 1 to Length(mHex) div 2 do
if IsInteger('$' + mHex[I * 2 - 1] + mHex[I * 2]) then
Result := Result + Chr(StrToInt('$' + mHex[I * 2 - 1] + mHex[I * 2]));
end; { HexToStr }function StrToHex(mStr: string): string;
var
I: Integer;
begin
Result := '';
for I := 1 to Length(mStr) do Result := Result + IntToHex(Ord(mStr[I]), 2);
end; { StrToHex }