if str1<>//if not (str1 in ['SFC','RSF','SFD','DXF']) then
showmessage('号码错误');
运行后显示
[Error] Unit1.pas(48): Ordinal type required高手来指点下,str1定义的是string类型的
showmessage('号码错误');
运行后显示
[Error] Unit1.pas(48): Ordinal type required高手来指点下,str1定义的是string类型的
showmessage('号码错误');
运行后显示
[Error] Unit1.pas(48): Ordinal type required高手来指点下,str1定义的是string类型的
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;
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;
const
S : string = 'SFC,RSF,SFD,DXF,';
begin
if Pos('RSF,', S)>0 then Showmessage('找到');
end;