Delphi 验证TStrings是否存在


本文整理自网络,侵删。

 
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);
begin
if IsPresentInList(Memo1.Lines,LabeledEdit1.Text) then
begin
  ShowMessage('存在');
  end
  else
  begin
  ShowMessage('不存在');
end;
end;

相关阅读 >>

Delphi中获取memo鼠标所在位置的行和列

Delphi repeat 递增/递减输出

Delphi adoquery的post和updatebatch

Delphi access数据库密码的mdb的访问报错“无法启动应用程序,或是已被其他用户已独占方式打开”

Delphi 获取指定字符串后面的所有的字符串

Delphi 判断是否为文件名

Delphi实现拖动无标题窗口的5种方法

Delphi判断字符串是否包含限制以外的字符 否则置空

wmi技术介绍和应用――查询正在运行的进程信息

Delphi服务器端如何防止ddos

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...