(index: number): (self: string) => Option.Option<string>
(self: string, index: number): Option.Option<string>Returns the character at the specified non-negative index safely, or None if the index is out of bounds.
Example (Reading characters safely)
import { pipe, String } from "effect"
pipe("abc", String.charAt(1)) // Option.some("b")
pipe("abc", String.charAt(4)) // Option.none()elements
Source effect/String.ts:5987 lines
export const const charAt: {
(index: number): (
self: string
) => Option.Option<string>
(
self: string,
index: number
): Option.Option<string>
}
Returns the character at the specified non-negative index safely, or None if the index is out of bounds.
Example (Reading characters safely)
import { pipe, String } from "effect"
pipe("abc", String.charAt(1)) // Option.some("b")
pipe("abc", String.charAt(4)) // Option.none()
charAt: {
(index: numberindex: number): (self: stringself: string) => import OptionOption.type Option.Option = /*unresolved*/ anyOption<string>
(self: stringself: string, index: numberindex: number): import OptionOption.type Option.Option = /*unresolved*/ anyOption<string>
} = import dualdual(
2,
(self: stringself: string, index: numberindex: number): import OptionOption.type Option.Option = /*unresolved*/ anyOption<string> => import OptionOption.filter(import OptionOption.some(self: stringself.String.charAt(pos: number): stringReturns the character at the specified index.
charAt(index: numberindex)), const isNonEmpty: (
self: string
) => boolean
Checks whether a string is non-empty.
Example (Checking for non-empty strings)
import { String } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(String.isNonEmpty(""), false)
assert.deepStrictEqual(String.isNonEmpty("a"), true)
isNonEmpty)
)