Skip to main content

rfind

Method of string.

Overloads​

NameDescription
rfind(const string f, integer pos) -> integerFinds the last occurrence of a substring at or before the given position.
rfind(string substr) -> ObjectFinds the last occurrence of a substring.

rfind(const string f, integer pos) -> integer​

Finds the last occurrence of a substring at or before the given position.

Parameters​

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

rfind(string substr) -> Object​

Finds the last occurrence of a substring.

Parameters​

  • substr: The substring to find.

Returns​

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

Example​

"abab".rfind("ab")
//-> 2