本文整理自网络,侵删。
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 extractclassname 字符串处理函数
更多相关阅读请进入《Delphi》频道 >>