很菜的问题。求setlength的语法。

解决方案 »

  1.   

    SetLength(var S; NewLength: Integer);var 
    str : AnisString ;
    str :='11111111111111111111' ;
    SetLength(str,10) ;
    表示从str中取前10个1保存到str中。
      

  2.   

    养成遇到问题先Delphi帮助,然后Google/baidu,之后csdn……
    Sets the length of a string or dynamic-array variable. procedure SetLength(var S; NewLength: Integer);
      

  3.   

    就是给字符串和动态数组设置长度,delphi自动给字符串和动态数组分配内存
    var
      s:string;
      arr: array of integer;
     
      setlength(s,10);
      setlength(arr,15);
      

  4.   

    SetLength(var S; NewLength: Integer);
    简单的想,就是指定长度。
    比如动态指定数据长度等等。
    并不存在拷贝的意思。