Built-in Functions → find

find() is a string function that returns the index value of the first occurrence of a string within another string.

Note

The offset is based on a zero index, find() returns the offset where the match is found. If there is no match, find() returns -1.

Signature

find(string exp1, string exp2)

The following table illustrates the find() parameters:

ParameterDescription
string exp1string to search for
string exp2string to be searched

Returns

int

Example

Find the first occurrence of "e" within "Hello"

find("e", "Hello")

This example returns a 1 based on zero offset.