indexOf
Module Export
text |> (pattern: regex | text) => numberReturns the index of the first occurrence of the pattern in a texgt
indexOf finds the first occurrence of pattern in the input text and returns the index of the first character. If
pattern is not found, -1 is returned.
Examples
Find using a text pattern
import { indexOf } from 'text'
from 'This is a sentence' indexOf ' is '
// Returns:4Find using a regex pattern
import { indexOf } from 'text'
from 'This is a sentence' indexOf / \w /
// Returns:7