function copy(s: string; from, count: integer): string;
procedure copyLastname; var Person, Nachname: string; aIndex: integer; begin Person := 'Mustermann Max'; aIndex := Pos(' ', Person); if aIndex > 0 then begin Nachname := copy(Person, 0, aIndex-1); Message_dlg(Nachname); end; end;