public function regionMatches(int $offset, $string, int $strOffset, int $len, bool $ignoreCase = false): bool
    {
        Assert::typeOf(['string', __CLASS__], $string);
        $strLen = \is_string($string) ? mb_strlen($string, $this->encoding) : $string->length();

        if ($offset < 0 || $strOffset < 0 || ($strOffset + $len) > $strLen || ($offset + $len) > $this->length()) {
            return false;
        }

        $stringA = mb_substr($this->data, $offset, $len, $this->encoding);
        $stringB = mb_substr((string) $string, $strOffset, $len, $this->encoding);

        // Compare strings
        if ($ignoreCase) {
            $result = strcmp(mb_strtolower($stringA, $this->encoding), mb_strtolower($stringB, $this->encoding));
        } else {
            $result = strcmp($stringA, $stringB);
        }

        return $result === 0;
    }