Skip to main content

find

Method of string.

Overloads

NameDescription
find(const string f, integer pos) -> integerFinds the first occurrence of a substring starting from the given position.
find(string substr) -> ObjectFinds the first occurrence of a substring.

find(const string f, integer pos) -> integer

Finds the first occurrence of a substring starting from the given position.

Parameters

  • f: The substring to search for.
  • pos: The position to start the search from.

find(string substr) -> Object

Finds the first occurrence of a substring.

Parameters

  • substr: The substring to find.

Returns

The match position, or the underlying not-found value.

Example

"abab".find("ab")
//-> 0