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 extractclassname 字符串处理函数

Delphi 获取系统时间,获取系统年月日,时分秒

Delphi urunpe

Delphi xe 播放 gif 动画

Delphi 数字排序自动完成

Delphi 如何将颜色值转换为灰度颜色值?

Delphi 的内存操作函数(1): 给字符指针分配内存

Delphi 让"显示桌面"功能对你的窗口无效

Delphi twebbrowser 获取cookie

干掉360保险箱vb/vc/Delphi 源码

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



打赏

取消

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

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

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

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

评论

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