想实现Str='12 15 32'
在combo下拉时后显示 str:= '12 15 32';
while Length(str) <= 0 do begin
Str1:= Copy(str,0,Pos(str,''));
str := Copy(str,Pos(str,''), Length(str));
ComboBox1.Items.Add(Str1);
Next;
end;
在combo下拉时后显示 str:= '12 15 32';
while Length(str) <= 0 do begin
Str1:= Copy(str,0,Pos(str,''));
str := Copy(str,Pos(str,''), Length(str));
ComboBox1.Items.Add(Str1);
Next;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
str: string;
begin
Str:='12 15 32';
combobox1.Items.Delimiter:=' ';
combobox1.Items.DelimitedText:=str;end;
拷贝的时候注意各个参数
while Length(str) <= 0 do begin 这里也错了,永远进不来的
i: integer;
begin
str:= '12 15 32';
while Length(str) > 0 do
begin
if Length(str) > 2 then
begin
i:=Pos(' ',str);
Str1:= Copy(str,0,i);
str := Copy(str,i+1, Length(str));
ComboBox1.Items.Add(Str1);
end
else
begin
ComboBox1.Items.Add(Str);
exit;
end;
end;