SystemInt (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

Click the button to display the integer part of any positive or negative real number.

Code

procedure TForm1.Button1Click(Sender: TObject);
var 
  R: Real;
begin
  R := StrToFloat(Edit1.Text);     { 123.456 }
  R := Int(R);                     { 123.0 }
  Edit2.Text := FloatToStr(R);
end;

Uses

Personal tools
Assistance