str.rpartition(sep) â [head, sep, tail]
str.rpartition(regexp) â [head, match, tail]
str.rpartition(regexp) â [head, match, tail]
Instance Public methods
Searches sep or pattern (regexp) in the string from the end of the string, and returns the part before it, the match, and the part after it. If it is not found, returns two empty strings and str.
"hello".rpartition("l") #=> ["hel", "l", "o"] "hello".rpartition("x") #=> ["", "", "hello"] "hello".rpartition(/.l/) #=> ["he", "ll", "o"]
Please login to continue.