public function indexOf($string, $offset = null)
    {
        $string = static::convertString($string, $this->encoding);
        $offset = $offset !== null ? (int) $offset : null;

        if ($offset !== null && ($offset < 0 || $offset >= $this->length())) {
            throw new \OutOfBoundsException();
        }

        return mb_strpos($this->string, $string, $offset, $this->encoding);
    }
public function indexOf($string, $offset = null)
    {
        $string = static::convertString($string, $this->encoding);
        $offset = $offset !== null ? (int) $offset : null;

        if ($offset !== null && ($offset < 0 || $offset >= $this->length())) {
            throw new \OutOfBoundsException();
        }

        return mb_strpos($this->string, $string, $offset, $this->encoding);
    }
Return the first occurrence of a string in the sequence.

@param string   $string The sequence to search for.
@param int|null $offset The offset index to search from.

@return int
@throws \OutOfBoundsException If the index is out of bounds.