find

Returns the index value of the first occurrence of a string within another string.

Example

Find the first occurrence of “e” within “Hello”

find("e", "Hello")

This example returns a 1 (zero offset).

Syntax

find(string s find, string expr field)
  • s: string to search for
  • field: string to be searched

Both s and field are expressions evaluating to the string type.

Returns

int

Notes

find returns the offset in the string field where s can be found. The offset is the index of the first character where the match is found. If there is no match, find returns -1.