function PosCh(ch: Char; const S: String): Integer;
var
I: Integer;
begin
for I:=1 to Length(S) do
if S[I] = ch then
begin
result := I;
Exit;
end;
result := 0;
end;
function ExtractOwner(const S: String): String;
var
P: Integer;
begin
result := '';
P := PosCh('@', S);
if P > 0 then
result := Copy(S, 1, P - 1);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
showmessage(ExtractOwner('abc123@163.com'));
end;