主题:请教一个IF语句的问题
原代码:
procedure TForm1.Button3Click(Sender: TObject);
var
t1,t2,t3,bkname,bkchapter,bksection:string;
num,iCount:integer;
txt1: TextFile;
begin
bkname:=edit3.Text;
iCount:=SendMessage(Memo1.Handle,EM_GETLINECOUNT,0,0);
for num:=0 to icount-1 do
begin
AssignFile(txt1, 'C:\MyFile.txt');
Append(txt1);
t1:=memo1.Lines[num];
[color=FF0000] if pos('章〓',t1)<>0 then
begin
delete(t1,1,pos('章〓',t1)+3);
t3:='#'+bkname+'_'+t1+'%;'+t1;
edit1.Text:=t1;
end[/color]
writeln(txt1,t3);
CloseFile(txt1);
end
end;
就是上面一段代码,如果不加IF语句没有一点问题,可是一加IF语句,就报“丢了操作符或;号”,不知是何原因,请指教
procedure TForm1.Button3Click(Sender: TObject);
var
t1,t2,t3,bkname,bkchapter,bksection:string;
num,iCount:integer;
txt1: TextFile;
begin
bkname:=edit3.Text;
iCount:=SendMessage(Memo1.Handle,EM_GETLINECOUNT,0,0);
for num:=0 to icount-1 do
begin
AssignFile(txt1, 'C:\MyFile.txt');
Append(txt1);
t1:=memo1.Lines[num];
[color=FF0000] if pos('章〓',t1)<>0 then
begin
delete(t1,1,pos('章〓',t1)+3);
t3:='#'+bkname+'_'+t1+'%;'+t1;
edit1.Text:=t1;
end[/color]
writeln(txt1,t3);
CloseFile(txt1);
end
end;
就是上面一段代码,如果不加IF语句没有一点问题,可是一加IF语句,就报“丢了操作符或;号”,不知是何原因,请指教