搜索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;
解决方案 »
- List index out of bounds
- 如何用Delhpi删除指定程序的所有快捷方式
- 关于Delphi内存分配的问题!
- 急,在线等,拜托大家
- 如何对已经得到查询结果的数据集(ADOQuery) 进行某个字段进行统计
- 【求救】按alt+z的时候出错:Access violation at address 0419528 in module 'test.ocx'
- 各位新年好!问个低档的..呵呵
- 各位大侠,用Delphi怎样获得本机上网的动态IP地址
- 帮我出个主意好吗?
- 能否解释一下memo的onchange和onexit
- 请问谁有或知道李维的ADO_MTS_COM+那本书或者下载?谢谢!
- 求助:软件公司对开发人员该如何管理?
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;