Flowdock
rindex(...) public

Returns the index of the last occurrence of the given substring, character (fixnum), or pattern (regexp) in str. Returns nil if not found. If the second parameter is present, it specifies the position in the string to end the search—characters beyond this point will not be considered.

"hello".rindex('e')             #=> 1
"hello".rindex('l')             #=> 3
"hello".rindex('a')             #=> nil
"hello".rindex(101)             #=> 1
"hello".rindex(/[aeiou]/, -2)   #=> 1
Show source
Register or log in to add new notes.