public static function insert($string, $substring, $index)
    {
        exception_if(!self::checkIndex($string, $index), StringOutIndexException::class);

        $str = '';

        for ($i = 0; $i < static::length($string); $i++) {
            if ($i == $index) {
                $str .= $substring;
            }

            $str .= $string[$i];
        }

        return $str;
    }