Finds the first occurrence of a substring in a string, from a
specified start position. The search is case-sensitive.

find(substring, String [, start]) → returns Numeric

Argument Reference for the find function


Required: Yes
The string you are looking for.


Required: Yes
The string to search in.


Required: No
Default: 1
The position to start searching in the string (starts at 1) Values:
  • 1

Examples sample code invoking the find function

Find apple in the string

Returns the index of apple in the string.

find("apple", "An apple a day keeps the doctor away.")

Expected Result: 4

Fork me on GitHub