effect-io-ai

Package: effect
Module: String

String.at

Returns the character at the specified relative index safely, or None if the index is out of bounds.

Example (Accessing characters safely)

import { pipe, String } from "effect"

pipe("abc", String.at(1)) // Option.some("b")
pipe("abc", String.at(4)) // Option.none()

Signature

declare const at: { (index: number): (self: string) => Option.Option<string>; (self: string, index: number): Option.Option<string>; }

Source

Since v2.0.0