effect-io-ai

Package: effect
Module: String

String.lastIndexOf

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

Example (Finding the last substring index)

import { pipe, String } from "effect"

pipe("abbbc", String.lastIndexOf("b")) // Option.some(3)
pipe("abbbc", String.lastIndexOf("d")) // Option.none()

Signature

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

Source

Since v2.0.0