- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
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;