Logo

Programming-Idioms

History of Idiom 22 > diff from v30 to v31

Edit summary for version 31 by :
[Pascal] uses SysUtils; -> I guess this is an import

Version 30

2015-12-30, 21:27:44

Version 31

2015-12-30, 21:28:32

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)

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