MEMO里有N行
判断每1行里的最后3个字符串是不是EXE,是就不管他,在判断下1行,如果最后3个字不是EXE就删除,
全部处理完后在判断每行的第2个字符是不是:号如果是就继续下1行,如果不是就删除
判断每1行里的最后3个字符串是不是EXE,是就不管他,在判断下1行,如果最后3个字不是EXE就删除,
全部处理完后在判断每行的第2个字符是不是:号如果是就继续下1行,如果不是就删除
解决方案 »
- 读串口问题!
- 想听听大家对用delphi做的浏览器有什么样的看法,
- ado控件操作db2数据库的问题?
- 在win2000 Professional、win2000 Server和win98这3个系统中选择一个,在其下开发的Delphi应用程序打包后在其他两个系统中能否正常运行?
- ado控件怎样连接excel文档
- delphi中关于 TOpenDialog 的问题
- 关于delphi中键盘输入的问题
- 高分求救!这个问题要折磨死我了
- 用Delphi编写CORBA数据库应用系统到底有无可行性?
- 编程中如何释放串口
- 关于窗口类型的问题
- 我的程序在前台经常出现'无法为更新定位行,一些值可能在最后一次读写已更改',,是什么原因?
i:Integer;
begin
for i:=Memo1.Lines.Count -1 downto 0 do
begin
if not SameText(rightstr(Memo1.Lines[i],3),'EXE')then
Memo1.Lines.Delete(i);
end;
for i:=Memo1.Lines.Count -1 downto 0 do
begin
if not SameText(leftstr(Memo1.Lines[i],2),':')then
Memo1.Lines.Delete(i);
end;
end;
StrUtils;var
i:Integer;
begin
for i:=Memo1.Lines.Count -1 downto 0 do
begin
if (not SameText(rightstr(Memo1.Lines[i],3),'EXE'))
or(not SameText(leftstr(Memo1.Lines[i],2),':')) then
Memo1.Lines.Delete(i);
end;
end;
i:integer;
begin
for i:=mmo1.Lines.Count-1 downto 0 do
begin
if (UpperCase(RightStr(mmo1.Lines[i],3))<>'EXE') or (mmo1.Lines[i][2]<>':') then
mmo1.Lines.Delete(i);
end;
end;
判断每1行里的最后3个字符是不是EXE,是就不管他,在判断下1行,如果最后3个字不是EXE就删除着1行,
全部处理完后在判断每行的第2个字符是不是:号如果是就继续下1行,如果不是就删除着1行
楼上的我测试了你的代码,怎么MEMO的内容全部删了呀,我要的是保留每行后3个字和每行前第2个字是:的内容
i:integer;
begin
for i:=mmo1.Lines.Count-1 downto 0 do
begin
if (UpperCase(RightStr(mmo1.Lines[i],3)) <>'EXE') or (mmo1.Lines[i][2] <>':') then
mmo1.Lines.Delete(i);
end;
end;
是可以的
你出现的全部删除掉可能是红色那里的分号,输入法为中文输入的分号
MEMO内容
c:\1.exe
c:\z\x\x\c
\2.exe
c:\2.exe
c:\3.exe
就把
c:\z\x\x\c
\2.exe
删除
保留
c:\1.exe
c:\2.exe
c:\3.exe
我试了都不行呀都是全部删除了
或者你的Memo的内容里有空格?
var
i:Integer;
begin
for i:=Memo1.Lines.Count -1 downto 0 do
begin
if (AnsiEndsText('.exe',memo1.Lines.Strings[i])=false)
or (memo1.Lines.Strings[i][2]<>':') then
Memo1.Lines.Delete(i);
end;end;
var
i:Integer;
begin
for i:=Memo1.Lines.Count -1 downto 0 do
begin
if (AnsiEndsText('.exe',trim(memo1.Lines[i]))=false)
or (memo1.Lines.Strings[i][2]<>':')
then
Memo1.Lines.Delete(i);
end;end;
希望各位朋友引以为诫,空格害死人。