搜索sourcestrs中前几位为pyindexstr的,并写入box里,函数一个。
Procedure SearchByPYIndexStr(Const SourceStrs:TStringList;Const PYIndexStr:string; Var Box:TListBox);
label NotFound;
var
i, j :integer;
hzchar :string;
begin
box.Items.Clear;
for i:=0 to SourceStrs.Count-1 do
begin
for j:=1 to Length(PYIndexStr) do
begin
if Length(SourceStrs[i])=0 then goto NotFound;
hzchar:=SourceStrs[i][j];
if PYIndexStr[j] <> hzchar
then goto NotFound;
end;
box.Items.Addobject(SourceStrs[i],sourcestrs.Objects[i]);
NotFound:
end;
end;
Procedure SearchByPYIndexStr(Const SourceStrs:TStringList;Const PYIndexStr:string; Var Box:TListBox);
label NotFound;
var
i, j :integer;
hzchar :string;
begin
box.Items.Clear;
for i:=0 to SourceStrs.Count-1 do
begin
for j:=1 to Length(PYIndexStr) do
begin
if Length(SourceStrs[i])=0 then goto NotFound;
hzchar:=SourceStrs[i][j];
if PYIndexStr[j] <> hzchar
then goto NotFound;
end;
box.Items.Addobject(SourceStrs[i],sourcestrs.Objects[i]);
NotFound:
end;
end;
Procedure SearchByPYIndexStr(Const SourceStrs:TStringList;Const PYIndexStr:string; Var Box:TListBox);
label NotFound;
var
i, j :integer;
hzchar :string;
begin
box.Items.Clear;
for i:=0 to SourceStrs.Count-1 do
begin
for j:=1 to Length(PYIndexStr) do
begin
if Length(SourceStrs[i])=0 then goto NotFound;
hzchar:=SourceStrs[i][j];
if PYIndexStr[j] <> hzchar
then goto NotFound;
end;
box.Items.Addobject(SourceStrs[i],sourcestrs.Objects[i]);
NotFound:
end;
end;