如"yes"是不是word pos people char中的一个?

解决方案 »

  1.   

    把那几个分开棏单词合成一个string就行了
      

  2.   

    if 'yes' in ['word','pos','people','char'] then 
       showmessage('在里面') 
     else
       showmessage('不在里面');
      

  3.   

    if 'yes' in ['word';'pos';'people';'char'] then
       showmessage('在里面')
     else
       showmessage('不在里面');
    编译不通过,提示"ordinal type required"
      

  4.   

    //写个函数吧
    function ins(s:string;sa:array of string;n:integer) :boolean;
    //设数组下标从0开始,并且为整型
    var i:integer;
    begin
      result:=false;
      for i:=0 to n-1 do
      if s =sa[i] then
        begin
         result:=true;
         break;
        end;
    end;procedure TForm1.Button1Click(Sender: TObject);
    var
    sa:array [0..3] of string;
    begin
      inherited;
      sa[0]:='aa';
      sa[1]:='bb';
      sa[2]:='cc';
      sa[3]:='dd';
      if ins('ee',sa,4) then showmessage('1') else showmessage('0');
      if ins('dd',sa,4) then showmessage('1') else showmessage('0');
    end;