public function insert($str, $pos)
    {
        self::mustBeString($str, 'String to insert');
        self::mustBeInteger($pos, 'Position');

        if ($pos instanceof N) {
            $pos = $pos->int;
        }

        if ($pos < 0) {
            throw new \InvalidArgumentException(
                'Position must be positive or null integer.'
            );
        }

        if ($pos > count($this)) {
            throw new \InvalidArgumentException(
                'Position must not be greater than length of current string.'
            );
        }

        if ($pos == count($this)) {
            return $this->append($str);
        }

        if ($pos == 0) {
            return $this->prepend($str);
        }

        $str1 = $this->sub(0, $pos);
        $str2 = $this->sub($pos, count($this) - 1);

        return static::concat($str1, $str, $str2);
    }