Autor Beitrag
WEBSTER
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 94



BeitragVerfasst: Di 29.01.08 15:01 
Salute,

ich suche nach einer Routine, um aus einem String eine Emailadresse heraus zu filtern.

ausblenden Quelltext
1:
2:
E-Mail 2: mpfc1@wedvb.de Peter Miller 18970234
E-Mail 2:mpfc2@wedvb.de - Hans Miller 18970234


Result: mpfc1@wedvb.de mpfc2@wedvb.de

Hätte jemand bereits eine passende Function zur Hand.....?

THX
WEBSTER

_________________
Wer etwas anders macht, aber nicht besser, der sollte besser etwas anderes machen.
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Di 29.01.08 15:09 
Ja - Pos, Copy. :wink:

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
WEBSTER Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 94



BeitragVerfasst: Di 29.01.08 15:20 
Salute,

hier mal die Quick und Dirty Variante...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
   procedure GetMail(aValue: string);
   var
      at: integer;
      start: integer;
      stop: integer;
      permittedChar: set of Char;
   begin
      if (Pos('@', aValue) = 0) or (Trim(aValue) = '') then exit
      else
         permittedChar := ['a'..'z', '.', '_', '-'];
      aValue := AnsiLowerCase(aValue);
      at := Pos('@', aValue);
      start := at - 1;
      while (aValue[start] in permittedChar) and (start > 0) do
      begin
         Dec(start)
      end;
      stop := at + 1;
      while (aValue[stop] in permittedChar) and (stop < length(aValue)) do
      begin
         Inc(stop)
      end;
      email_dest_Memo.lines.add(Copy(aValue, start, (stop - start) + 1));
   end;


WEBSTER

Moderiert von user profile iconNarses: Code- durch Delphi-Tags ersetzt

_________________
Wer etwas anders macht, aber nicht besser, der sollte besser etwas anderes machen.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 29.01.08 23:22 
Moin!

Schau mal nach Suche in: Delphi-Library TREGEXPR, damit sollte das auch recht komfortabel gehen. :idea:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.