2011년 9월 30일 금요일

HexToAsc



String 형태의 Hex 값을 String 형태의 Ascii 값으로 변환

function TForm1.HexToAsc(strData: String): String;
var
  sresult: String;
  sfinal: String;
  hexc: Cardinal;
  i: Integer;
begin
  i := 1;

  while i <= Length(strData) do
  begin
    hexc := StrToInt('$' + Copy(strData,i,2));
    sresult := IntToStr(hexc);
    sresult := chr(StrToInt(sresult));
    sfinal := sfinal + sresult;
    i := i + 2;
  end;

  Result := sfinal;
end;

댓글 없음: