本文整理自网络,侵删。
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 测试字符串写入类: tstringwriter
Delphi windows 编程[9] - wm_close 消息
winapi 字符及字符串函数(4): charupperbuff - 把缓冲区中指定数目的字符转大写
更多相关阅读请进入《Delphi》频道 >>