SysUtilsStrToIntDef (C++)
Description
This example uses two edit boxes and a button on a form. You have to enter a number in the first edit box and click 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.
Code
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int Number = StrToIntDef(Edit1->Text, 1000);
Edit2->Text = IntToStr(Number);
}
Uses
- System.SysUtils.StrToIntDef ( fr | de | ja )