Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
var
counter: Integer;
individualDigit: Integer;
exponentCounter: Integer;
total: Double;
quadValue: String;
begin
total := 0;
exponentCounter := 0;
quadValue := Trim(Edit3.Text);
for counter := Length(quadValue) downto 1 do
begin
individualDigit := StrToInt(quadValue[counter]);
total := total + (individualDigit * Power(4, exponentCounter));
Inc(exponentCounter);
end;
label1.Caption := Format('%x',[Round(total)]);
end;
{ Convert a base-4 string expression to a base 10 integer }
function QuadStringToInt( AQuadNumber: string ): integer;
var
i,n,m:integer;
begin
Result := 0;
m := 1;
n := Length( AQuadNumber );
for i := n downto 1 do
begin
Result := Result + StrToInt( AQuadNumber[i] ) * m;
m := m * 4
end;
end;
{Test QuadStringToInt() function.}
procedure TForm1.Button1Click(Sender: TObject);
var
n:integer;
begin
n := QuadStringToInt(Edit1.Text);
Edit2.Text := Format( 'Hex = %x Decimal = %d' ,[n,n] );
end;