Mega Code Archive

 
Categories / Delphi / String
 

Set limit for string

Title: Set limit for string You can set limit for the string, when you define a variable of string type. But it will variable of ShortString type, if you will set a limitation for the string. procedure TForm1.Button1Click(Sender: TObject); var MyStr: string[60]; begin MyStr:='This string must contain not more 60 symbols'; Label1.Caption:=MyStr; end;