DelphiBasics
MaxInt
Constant
The maximum value an Integer can have System unit
  const MaxInt = High(Integer);
Description
The MaxInt constant gives the largest allowed value for an Integer.
 
The value is normally (2^32)-1 = 2,147,483,647 but is not guaranteed to be so in all Delphi releases.
 
It is often used when the size of something, such as an array, is unknown.
Related commands
Integer The basic Integer type
MaxLongInt The maximum value an LongInt can have
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 Download this web site as a Windows program.




 
Example code : Copying the trailing characters of a string
// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.
 
unit Unit1;
 
interface
 
uses
  // The System unit does not need to be defined
  Forms, Dialogs;
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;
 
var
  
Form1: TForm1;
 
implementation
{$R *.dfm} // Include form definitions
 
procedure TForm1.FormCreate(Sender: TObject);

var
  Source, Target : string;

begin
  Source := 'Assume that we do not know how long this string is';

  // Copy all characters from the 8th onwards
  Target := Copy(Source, 8, MaxInt);

  ShowMessage('Source : '+Source);
  ShowMessage('Target : '+Target);
end;
 
end.
Hide full unit code
   Source : Assume that we do not know how long this string is
   Target : that we do not know how long this string is
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Home Page