Hyperlinkv0.8.0-beta.28

String

String.atconsteffect/String.ts:578
(index: number): (self: string) => Option.Option<string>
(self: string, index: number): Option.Option<string>

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()
elements
Source effect/String.ts:5784 lines
export const at: {
  (index: number): (self: string) => Option.Option<string>
  (self: string, index: number): Option.Option<string>
} = dual(2, (self: string, index: number): Option.Option<string> => Option.fromUndefinedOr(self.at(index)))