function EstaAlFinal(Buscado, Texto: string): Boolean;
begin
Result:= RightStr(Texto,Length(Buscando))=Buscando;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
s, t:string;
begin
s:= 'Pedro y Juan están programando en casa';
t:= 'programando en casa';
if EstaAlFinal(t, s) then
ShowMessage('Encontrada al final del texto') else
ShowMessage('No se encuentra al final del texto');
end;