(searchString: string): (self: string) => Option.Option<number>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()searching
Source effect/String.ts:6412 lines
export const const indexOf: (
searchString: string
) => (self: string) => Option.Option<number>
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()
indexOf = (searchString: stringsearchString: string) => (self: stringself: string): import OptionOption.type Option.Option = /*unresolved*/ anyOption<number> =>
import OptionOption.filter(import OptionOption.some(self: stringself.String.indexOf(searchString: string, position?: number): numberReturns the position of the first occurrence of a substring.
indexOf(searchString: stringsearchString)), import numbernumber.isGreaterThanOrEqualTo(0))