本文整理自网络,侵删。
function IsPresentInList(strings: TStrings; const value: string): Boolean;var i: Integer;begin Result := False; for i := 0 to strings.Count - 1 do if SameText(strings[i], value) then Exit(True);end;
procedure TForm1.Button1Click(Sender: TObject);beginif IsPresentInList(Memo1.Lines,LabeledEdit1.Text) thenbegin ShowMessage('存在'); end else begin ShowMessage('不存在');end;end;
相关阅读 >>
Delphi adoquery的post和updatebatch
Delphi access数据库密码的mdb的访问报错“无法启动应用程序,或是已被其他用户已独占方式打开”
更多相关阅读请进入《Delphi》频道 >>