如题

解决方案 »

  1.   

    因为str[0]里面存放的是字符串长度
      

  2.   


    语法规则而已。
    我来验证一下楼上是正确的
    procedure TForm1.Button1Click(Sender: TObject);
    var
      S1: string[255];{短字符串}
      S2: string;{长字符串}
      P: PByte;
    begin
      S1 := StringofChar(#32, 255);
      Showmessage(InttoStr(Byte(S1[0])));  S2 := InttoStr(Handle)+FormatDatetime('YYYYMMDDhhnnsszzz',Now);
      Showmessage(InttoStr(Length(S2)));
      integer(P) := integer(@S2[1])-4;
      Showmessage(InttoStr(P^));
    end;
      

  3.   

    哦,忘记说了,对于短字符串,一楼是正确的;而对于长字符串,却不仅仅存储在String[0]里,因为一个字节的内存只能最大有256个有效数字。对于长字符串,从string[1]后4个字节是长度。
      

  4.   

    这是delphi编译器认定的没什么好说的,记住就得 了