StrToIntDef converts a String into an Integer data type.

If the String does not contain a Integer value it will default to the value as supplied as the def parameter.

Declaration: Function StrToIntDef( const S : string; def: Longint) : Integer;

The example is.

procedure OnMapEvent(var Value:Variant);
var MyAmount : String;
begin
MyAmount := '123';
//Value will be equal to 123 or 0 in case of error
Value := StrToIntDef(MyAmount,0);
end;