1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| procedure ExtrairePhrases3(RichEdit : TRichEdit );
var
Texte, phrase, caractere: string;
i, LongueurTexte: integer;
separateurs: string;
begin
phrase := '';
Texte := RichEdit.Text;
LongueurTexte := Length(Texte);
separateurs :='!.?'; //Etablit la liste des séparateurs de phrases
for i:=1 to LongueurTexte do
begin
caractere := Texte[i];
phrase := phrase + caractere;
if Pos(caractere, separateurs) <> 0 then
begin
ShowMessage(Trim(phrase));
phrase := '';
end
else if i=LongueurTexte then
ShowMessage(Trim(phrase));
end;
end; |
Partager