T
tianzhen
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.FormCreate(Sender: TObject);
var
mychar:array of char;
tmp:tstringlist;
begin
setlength(mychar,1);
mychar[0]:='t';
tmp:=tstringlist.create;
tmp.Add(mychar); //Incompatible types: 'string' and 'dynamic array'
showmessage(tmp.Strings[0]);
end;
用tmp.Add(string(mychar)); 结果错误,因为string的下标从1开始
var
mychar:array of char;
tmp:tstringlist;
begin
setlength(mychar,1);
mychar[0]:='t';
tmp:=tstringlist.create;
tmp.Add(mychar); //Incompatible types: 'string' and 'dynamic array'
showmessage(tmp.Strings[0]);
end;
用tmp.Add(string(mychar)); 结果错误,因为string的下标从1开始