if str1<>//if not (str1 in ['SFC','RSF','SFD','DXF']) then
    showmessage('号码错误');
运行后显示
[Error] Unit1.pas(48): Ordinal type required高手来指点下,str1定义的是string类型的

解决方案 »

  1.   

    if not (str1 in ['SFC','RSF','SFD','DXF']) then
      showmessage('号码错误');
    运行后显示
    [Error] Unit1.pas(48): Ordinal type required高手来指点下,str1定义的是string类型的
      

  2.   

    不如使用else if语句对以上字符串进行循环比较。
      

  3.   

    可以用别的方法:
    const
      TAText: array [0 .. 3] of string = ('SFC', 'RSF', 'SFD', 'DXF');
    var
      str1: string;
      st: TStringList;
      I: Integer;
    begin
      str1 :='SFC0';
      st := TStringList.Create;
      for I := Low(TAText) to High(TAText) do
      begin
        st.Add(TAText[I]);
      end;
      if st.IndexOf(str1) = -1 then
        ShowMessage('号码错误');
      st.Free;
    end;
      

  4.   

    你用case of 语句写好了。
      

  5.   


    var
      SS : TStringList;
    begin
      SS := TStringList.Create;
      SS.Text := 'SFC'#10'RSF'#10'SFD'#10'DXF';
      if SS.IndexOf('RSF')<0 then Showmessage('没有') else Showmessage('找到') ;
      SS.Free;
    end;
      

  6.   


    const
      S : string = 'SFC,RSF,SFD,DXF,';
    begin
      if Pos('RSF,', S)>0 then Showmessage('找到');
    end;