Returns the index within this string of the last occurrence of
the specified character, searching backward starting at the
specified index. For values of ch in the range
from 0 to 0xFFFF (inclusive), the index returned is the largest
value k such that:
is true. For other values of(this.charAt(k) == ch) && (k <= fromIndex)
ch, it is the
largest value k such that:
is true. In either case, if no such character occurs in this string at or before position(this.codePointAt(k) == ch) && (k <= fromIndex)
fromIndex, then
-1 is returned.
All indices are specified in char values
(Unicode code units).
ch | a character (Unicode code point). | |
fromIndex | the index to start the search from. There is no
restriction on the value of fromIndex. If it is
greater than or equal to the length of this string, it has
the same effect as if it were equal to one less than the
length of this string: this entire string may be searched.
If it is negative, it has the same effect as if it were -1:
-1 is returned. |
fromIndex, or -1
if the character does not occur before that point.
Diagram: String