protected function lastIndexOfDynamic($function, $needle, $offset=0)
    {
        $r = $function($this->toString(), $needle, $offset, $this->getEncoding());
        return ($r===false ? -1 : $r);
    }