Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/rimbu/typical/str.ts>CharAt

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
type alias CharAt
import { type CharAt } from "https://deno.land/x/rimbu@1.0.2/typical/str.ts";

Returns the character in the given string at the given Index, or false if the index is out of bounds.

Examples

Example 1

CharAt<'abcd', 1> => 'b'
CharAt<'abcd', 5> => false

Type Parameters

S extends string
Index extends number
definition: S extends Append<infer Start, infer Rest> ? U.Extends<Index, 0, Start, CharAt<Rest, Num.Decr<Index>>> : false