effect-io-ai

Package: effect
Module: String

String.indexOf

Returns the index of the first occurrence of a substring safely, or None if not found.

Example (Finding the first substring index)

import { pipe, String } from "effect"

pipe("abbbc", String.indexOf("b")) // Option.some(1)
pipe("abbbc", String.indexOf("z")) // Option.none()

Signature

declare const indexOf: (searchString: string) => (self: string) => Option.Option<number>

Source

Since v2.0.0