String

This is an old revision of String, edited by FPC user at . The current revision is 32238.

Mention command line option for String alias control, link to documentation for command line options and compiler directives

String is a Type which may contain characters. String is a synonym for ShortString or AnsiString depending on the current compiler setting.

If compiler directive {$H} or compiler directive {$LongStrings} is on ( {$H+} or {$LongStrings ON} ), then a String type is the same as an AnsiString type, if not ( {$H-} or {$LongStrings OFF} ), it is a ShortString type. What String is an alias for can also be set by the -Sh command line option.

The ShortString maximum length can be decided by the programmer (e.g. name : String[25];) but is limited to 255 characters. If a ShortString length is not explicitly given, then the length is implicitly set to 255.

The length of an AnsiString is limited by the value of High(SizeInt) (which is platfom dependant) and available memory.

In the future, there might be a compiler switch to have the String type refer to a Unicode (UTF-8 or UTF-16) String type.

See also

navigation bar: data types

simple data types boolean byte cardinal char currency double dword extended int8 int16 int32 int64 integer longint real shortint single smallint pointer qword word
complex data types array class object record set string shortstring