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 try abort、exit except 、finally end 执行情况

Delphi formatdatetime 显示日期时间

Delphi 合并文本行的函数

Delphi修改资源文件的代码

Delphi 按f11程序全屏

Delphi

Delphi 读cpu串号的代码

Delphi android device information

Delphi cxgrid中回车键光标移到下列

Delphi 抓图后打印这张图片,弹出打印属性框

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



打赏

取消

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

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

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

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

评论

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