hedgewars/uUtils.pas
changeset 13877 8c702a4839ec
parent 13821 94d0d1ab7a0e
child 13879 6b2c87490f0a
equal deleted inserted replaced
13876:aa321e51da14 13877:8c702a4839ec
   334 
   334 
   335 // Convert string to longint, with error checking.
   335 // Convert string to longint, with error checking.
   336 // Success will be set to false when conversion failed.
   336 // Success will be set to false when conversion failed.
   337 // See documentation on Val procedure for syntax of s
   337 // See documentation on Val procedure for syntax of s
   338 function StrToInt(s: shortstring; var success: boolean): LongInt;
   338 function StrToInt(s: shortstring; var success: boolean): LongInt;
   339 var Code: Word;
   339 begin
   340 begin
   340 val(s, StrToInt);
   341 val(s, StrToInt, Code);
   341 success:= StrToInt <> nil;
   342 success:= Code = 0;
       
   343 end;
   342 end;
   344 
   343 
   345 // Convert string to longint, without error checking
   344 // Convert string to longint, without error checking
   346 function StrToInt(s: shortstring): LongInt;
   345 function StrToInt(s: shortstring): LongInt;
   347 var success: boolean; // ignored
   346 var success: boolean; // ignored