# indexOf

## indexOf(source: text, pattern: text) 🡒 number, pure function

Returns the index of the first occurrence of the pattern within the text, or −1, if no such occurrence is found.

Example:

source = "Hello World!"
show summary "" a1c3 with
indexOf(source, "o")
indexOf(source, "!")
indexOf(source, "Z")


The index value returned by indexOf is frequently intended to be later consumed by the function substr.