Name

String Keyword

Syntax

type string;
type Name = string[Constant];

Description

The string keyword represents the string type, which is either AnsiString or ShortString, depending on its use and the $H or $LongStrings compiler directive.

Without a maximum length in square brackets, string is the same as AnsiString (unless you use the $H or $LongStrings compiler directive). With a maximum length, string is a short string type. The maximum string length must be in the range to 255.

See AnsiString and ShortString for more details.

See Also

AnsiChar Type, AnsiString Type, Char Type, Length Function, OleStrToString Function, OleStrToStrVar Procedure, PChar Type, PWideChar Type, SetLength Procedure, SetString Procedure, ShortString Type, StringToOleStr Function, StringToWideChar Function, WideChar Type, WideCharLenToString Function, WideCharLenToStrVar Procedure, WideCharToString Function, WideCharToStrVar Procedure, WideString Type, $H Compiler Directive, $LongStrings Compiler Directive

Get Delphi in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.