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 判断tcp端口是否被占用的方法

Delphi eof 判断文件指针是否移动到了文件未尾

Delphi 测试字符串写入类: tstringwriter

Delphi windows 编程[9] - wm_close 消息

Delphi 字符串的分割

Delphi richedit中插入带背景色文本的一种思路

winapi 字符及字符串函数(4): charupperbuff - 把缓冲区中指定数目的字符转大写

Delphi用代码实现注册ocx和dll

Delphi 获取鼠标坐标大全方法

Delphi 时间转换为gmt格式

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



打赏

取消

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

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

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

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

评论

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