unit SysUtilsStrToIntDef;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: SysUtilsStrToIntDef
// Routine: SysUtils.StrToIntDef

// BeginCode
{
This example uses two edit boxes and a button on a form. The
user enters a number in the first edit box and clicks the
button. If the number entered was a valid integer, the same
value appears in the second edit box. If the number was not
a valid integer, the default value of 1000 appears in the
second edit box:
}
procedure TForm1.Button1Click(Sender: TObject);
var
  Number: Integer;
begin
  Number := StrToIntDef(Edit1.Text, 1000);
  Edit2.Text := IntToStr(Number);
end;
// EndCode
// EndExample: SysUtilsStrToIntDef
end.
