Programming-Idioms

History of Idiom 22 > diff from v13 to v14

Edit summary for version 14 :

Version 13

2015-08-20, 16:22:38

Version 14

2015-08-21, 06:25:00

Idiom #22 Convert string to integer

Extract integer value i from its string representation s (in radix 10)

Idiom #22 Convert string to integer

Extract integer value i from its string representation s (in radix 10)

Code
uses SysUtils;
var
  i: Integer;
 S: String;
begin
  S := '123';
  i := StrToInt(S);
end.
Comments bubble
The function StrToInt will raise an exception of type EConvertError if the string is not a proper representation of an integer.