Registriert seit: 29. Mai 2002
Ort: Frankfurt
8.252 Beiträge
Delphi 2006 Professional
|
Re: eMailadresse aus String filtern
27. Jul 2005, 13:58
Hai,
das habe ich mal so schnell hingetippelt.
Delphi-Quellcode:
function ExtractiMehl (aValue : string) : string;
var
at : integer;
start : integer;
stop : integer;
permittedChar : SET of Char;
begin
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;
result := Copy (aValue,start,(stop-start));
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Label1.Caption := ExtractiMehl(Edit1.Text)
end;
Stephan B. "Lasst den Gänsen ihre Füßchen"
|
|
Zitat
|