function IntToStrAsHex(var S: string; V: Cardinal): Boolean;
var
i: Integer;
begin
S := '';
repeat
i := V and $F;
V := V shr 4;
S := IntToHex(i, 1) + S;
until V = 0;
Result := True;
end;
function StrToIntAsBin(var V: Cardinal; S: string): Boolean;
var
i, j: Cardinal;
begin
Result := IsBinStr(S);
if not Result then Exit;
V := 0;
for i := 1 to Length(S) do
begin
j := Ord(S) - Ord('0');
V := (V shl 1) + j;
end;
Result := True;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
s,a:string;
V: Cardinal;
begin
a:='01000001';
if StrToIntAsBin(V, a) then
begin
IntToStrAsHex(S, V);
edit1.text:= S;
end;
end;