Short strings

A string declaration declares a short string in the following cases:
  1. If the switch is off: {$H-}, the string declaration will always be a short string declaration.
  2. If the switch is on {$H+}, and there is a length specifier, the declaration is a short string declaration.

The predefined type ShortString is defined as a string of length 255:

  ShortString = String[255];

If the size of the string is not specified, 255 is taken as a default. The length of the string can be obtained with the Length (527) standard runtime routine. For example in

 {$H-}
 
 Type
    NameString = String[10];
    StreetString = String;
NameString can contain a maximum of 10 characters. While StreetString can contain up to 255 characters.