procedure TForm1.Button1Click(Sender: TObject);
begin with Edit1 do beginif Indexof('abc')>-1 thenDelete (Indexof('abc'));end;
end;

解决方案 »

  1.   

    if Text.Indexof('abc')>-1 thenDelete (Text.Indexof('abc'));
      

  2.   

    [Error] Unit1.pas(32): Record, object or class type required
    [Error] Unit1.pas(40): Statement expected but end of file found
    [Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
      

  3.   

    if Text.Indexof('abc')>-1 then      是32行
      

  4.   

    我想按下Button把 Edit1.Text 中的abc字符串删掉。
      

  5.   

    你到底要实现什么功能你说说或许我们会有更好的方法,不要非要加indexof啊,
      

  6.   

    你的代码是用于删除如TComboBox对象的Items中的一条的
    要实现你的要求可以这样
    Edit1.Text:=StringReplace(Edit1.Text,'abc','',[rfReplaceAll]);
      

  7.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin  edit1.Clear;end;
      

  8.   

    回复人: li_zhifu(东北人) ( ) 信誉:115 高
      

  9.   

    我是想练习下 IndexOf()的用法, Edit1.Text 中的字符串是 abcdabcdabcd ,我想用IndexOf() 来删除所以的abc字符串,剩下ddd字符串。
      

  10.   

    验证通过!
    procedure TForm1.Button1Click(Sender: TObject);
    var
      i: integer;
      s: String;
    begin
      if Edit1.Text<>'' then
      begin
        s:= Edit1.Text;
        i:= pos('abc', Edit1.Text);
        if i<>0 then
          Delete(s, i, 3);
        Edit1.Text:= s;
      end;
    end;
      

  11.   

    用StringReplace也可以,而且更简单