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: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75:
| unit Unit2;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Clipbrd, ComCtrls ;
type TForm2 = class(TForm) Button1: TButton; ListBox1: TListBox; procedure Button1Click(Sender: TObject); private public end;
var Form2: TForm2; zw:string; implementation
{$R *.dfm} function StringIsEmail(str:string):boolean; var i:integer; bed1,bed2:boolean; begin result:=false; bed1:=false; bed2:=false; for i:=1 to length(str) do begin if str[i]='@' then bed1:=true; if str[i]='.' then bed2:=true; if bed1 and bed2 then result:=true else result:=false; end; end;
function FindeWort(index:integer;str:string):string; var i:integer; begin i:=index; result := ''; while (i<=length(str)) and not (str[i] in [' ', ',', ':']) do begin result:=result+str[i]; inc(i); end; end;
procedure FindEmailAdressen(str:string); var i,p:integer; s:String; begin i:=0; repeat p:=i; s:=FindeWort(p,str); if StringIsEmail(s) then Form2.ListBox1.AddItem(FindeWort(p,str),Form2.Listbox1); i:=i+length(s)+1; until i>=length(str); end;
procedure TForm2.Button1Click(Sender: TObject); begin Listbox1.Items.Clear; zw:='Hallo max.mustermann@test.de, wie geht es dir? Gruß frau.mustermann@test.de .'; FindEmailAdressen(zw); end;
end. |