strrchr method

int strrchr(
  1. String str,
  2. String c
)

Finds the last occurrence of the character c (given as a String) in the string str.

Returns the index of the character, or -1 if the character is not found.

Implementation

int strrchr(String str, String c) {
  if (c.isEmpty) return -1;
  return str.lastIndexOf(c[0]);
}