Delphi Programming
Advertisement
This page is intended as a supplement to the official documentation on Delphi programming. CodeGear is in the process of putting the Delphi documentation on the Web. Once they have done so, this page will link to the relevant page in the official documentation.
Stub
This article is a stub.
Please help enhance the Delphi Programming Wiki by expanding it.
Info
see the VCL Documentation Guidelines for an overview on doc pages

Unit[]

Description[]

Definition:

function IntToStr(Value: Int64): string;


Attempt to convert a string to an integer. If the string cannot be converted, use the default value supplied.

Technical Comments[]

(Known issues / Documentation clarifications / Things to be aware of)

Examples[]

var
  a, b, c, d, e: Integer;
begin
  a := StrToIntDef('1', 2);   //a will be 1
  b := StrToIntDef('1a', 2);  //b will be 2
  c := StrToIntDef('-1', 2);  //c will be -1
  d := StrToIntDef('1.1', 2); //d will be 2
  e := StrToIntDef('1,1', 2); //e will be 2

  ShowMessage('a:' + IntToStr(a) + #13#10 + 'b:' + IntToStr(b) + #13#10 + 'c:' +
    IntToStr(c) + #13#10 + 'd:' + IntToStr(d) + #13#10 + 'e:' +
    IntToStr(e) + #13#10);
end;

See Also[]

User Comments/Tips[]

(Please leave your name with your comment.)

Advertisement