长字串与短字串


procedure TForm1.Button1Click(Sender: TObject);

var

  s1: ShortString;  //为兼容老版本而存在

  s2: string;       //长字串,相当于动态字符数组

  s3: string[10];   //短字串,相当于静态字符数组,代替 ShortString

begin

  ShowMessage(IntToStr(SizeOf(s1)));  //256

  ShowMessage(IntToStr(SizeOf(s2)));  //4

  ShowMessage(IntToStr(SizeOf(s3)));  //11

end;

你可能感兴趣的:(长字串与短字串)