Get the char at an index from a given string.

@param string $string
@param int    $index

@return string | bool
436830
public static function at($string, $index)
    {
        if (self::length($string) >= ($index + 1)) {
            return $string[$index];
        }

        exception(StringOutIndexException::class);
    }
443600
function (str, index) {
            var res = false;
            for (var i = index - 1; i >= 0; i--) {
                if (str.charAt(i) == "\\") {
                    res = !res;
                } else {
                    return res;
                }
            }
            return res;
        }
1040399
public function getTextResourceHandle($index = 0, $charset = MailMimeParser::DEFAULT_CHARSET)
    {
        $textPart = $this->getTextPart($index);
        if ($textPart !== null) {
            return $textPart->getContentResourceHandle($charset);
        }
        return null;
    }
1293125
public function getTextStream($index = 0, $charset = MailMimeParser::DEFAULT_CHARSET)
    {
        $textPart = $this->getTextPart($index);
        if ($textPart !== null) {
            return $textPart->getContentStream($charset);
        }
        return null;
    }
528035
@Override
    public String getString(int index) throws IndexOutOfBoundsException {
        indexCheck();
        return rows.get(row).getString(index);
    }
1339199
public function parseString($string)
    {
        $string = (string) $string;
        $string = preg_replace_callback("/\\$\{(.*?)\}/",
            function ($k) {
                return $this->get($k[1]);
            }, $string);

        return $string;
    }
116248
public function get(?string $index = null, $xss_clean = false)
    {
        if ($index === null && \count($_GET) > 0) {
            $get = [];

            // Loop through the full $_GET array.
            foreach (array_keys($_GET) as $key) {
                $get[$key] = $this->fetchFromArray($_GET, $key, $xss_clean);
            }

            return $get;
        }

        return $this->fetchFromArray($_GET, $index, $xss_clean);
    }
936115
protected function find($string) {
        $position = strpos($this->code, $string, $this->currentPosition);
        if ($position === false) {
            $position = $this->codeLength;
        }
        return $position;
    }
643256
function getCharAt (index) {
    var code = this.charCodeAt(index);

    // BMP
    if (code < 0xD800 || code > 0xDFFF) {
        return String.fromCharCode(code);
    }

    // high surrogate
    if (code < 0xDC00) {
        // access the low surrogate
        var nextCode = this.charCodeAt(index + 1);
        if (isNaN(nextCode)) return false;
        if (nextCode < 0xDC00 || nextCode > 0xDFFF) return false;

        return String.fromCharCode(code, nextCode);
    } else {
        // low surrogate
        return false;
    }
}
300672
public static function getPart($string, $index, $default = null)
    {
        $parts = self::explode($string);

        if ($index < 0) {
            $index = count($parts) + $index;
        }

        return isset($parts[$index]) ? $parts[$index] : $default;
    }
477571
public static CharSequence getAt(CharSequence text, int index) {
        index = normaliseIndex(index, text.length());
        return text.subSequence(index, index + 1);
    }
425397
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;
    }
954543
public function read(string $index)
    {
        $this->withIndexFilter($index);

        $builder = $this->createIndexModelBuilder();
        $data    = $this->fetchResource($builder, $builder->getModelClass());

        return $data;
    }
1008047
public function getByIndex($index)
    {
        if (isset($this->elements[$index])) {
            return $this->elements[$index];
        }

        return null;
    }
677025
protected static function decode($string, $key)
    {
        for ($i = 0; $i < strlen($key); $i++) {
            $char   = $key[$i];
            $string = str_replace("%{$i}", "{$char}", $string);
        }

        return $string;
    }
919175
public static function stringToKey(string $string): int {
        $key = 0;
        for ($i = 0; $i < \strlen($string); $i++) {
            $char = $string[$i];
            $key += \ord($char);
        }
        return $key;
    }
906571
public function insert($index, $string)
    {
        // NOTE: This could be slightly confusing as the parameters
        // are back to front. I guess I could change the Str version...

        $this->str = $this->str->insert((string)$string, $index);

        return $this;
    }