B
bingxueshanren
Unregistered / Unconfirmed
GUEST, unregistred user!
我想找一篇文章里所有的句号、问号或叹号,并且在找到这些标点符号后,我要将其换行,直至将整篇文章都格式化成一句一行的形式,下面是我写的一个算法,已经能够找到第一个句号,并能够换行,但不知该如何往下继续循环查找后面的,也将其换行。
procedure TForm1.Button2Click(Sender: TObject);
var
I,Posi: Integer;
Left,Right: string;
sign: string;
MaxLen: integer;
begin
Maxlen := Length(RichEdit1.Text);
//ShowMessage(inttostr(Maxlen));
Sign := RichEdit1.Text;
for i:=1 to MaxLen do
if (sign='.') or (sign='?') or (sign='!') then
begin
Posi:=I;
break;
end;
for i:=1 to Posi do
begin
Left:=Left+sign;
//ShowMessage(LeftFile);
end;
for i:=Posi+1 to MaxLen do
begin
Right:=Right + sign;
//ShowMessage(Right);
end;
RichEdit1.Text :=Left+ #13#10 + Right;
end;
请各位看看,帮我该一下哦。谢谢了。
procedure TForm1.Button2Click(Sender: TObject);
var
I,Posi: Integer;
Left,Right: string;
sign: string;
MaxLen: integer;
begin
Maxlen := Length(RichEdit1.Text);
//ShowMessage(inttostr(Maxlen));
Sign := RichEdit1.Text;
for i:=1 to MaxLen do
if (sign='.') or (sign='?') or (sign='!') then
begin
Posi:=I;
break;
end;
for i:=1 to Posi do
begin
Left:=Left+sign;
//ShowMessage(LeftFile);
end;
for i:=Posi+1 to MaxLen do
begin
Right:=Right + sign;
//ShowMessage(Right);
end;
RichEdit1.Text :=Left+ #13#10 + Right;
end;
请各位看看,帮我该一下哦。谢谢了。