if 3 in edit1.Text
then
showmessage('3在编辑筐里')
else
showmessage('3不在编辑筐里');
为什么会报
[Error] Unit1.pas(30): Operator not applicable to this operand type
then
showmessage('3在编辑筐里')
else
showmessage('3不在编辑筐里');
为什么会报
[Error] Unit1.pas(30): Operator not applicable to this operand type
in membership ordinal, set Boolean A in Set1应为set 类型才行,这里是个String ,类型不匹配,可以下面这样
procedure TForm1.Button1Click(Sender: TObject);
begin
if Pos('3',Edit1.Text)>0 then
showmessage('3在编辑筐里')
else
showmessage('3不在编辑筐里');
end;
begin
if pos('3',edit1.Text)<>0 then
begin
showmessage('In');
end
else
begin
showmessage('Out');
end;
end;