method
rpartition
![Moderate documentation Importance_2](https://d2vfyqvduarcvs.cloudfront.net/images/importance_2.png?1349367920)
rpartition(p1)
public
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"]
Register or
log in
to add new notes.
marceloaustria -
March 19, 2014 - (v1_8_6_287 - v1_9_3_392)
![Default_avatar_30](https://www.gravatar.com/avatar/336aef9cb701f8441008e9cf12fd38e7?size=30&default=http://apidock.com/images/default_avatar_30.png)
1 thank
Right Partitioning Filename extension
1.9.3p392 :013 > x = “picture.2.jpg”
=> "picture.2.jpg"
1.9.3p392 :015 > x.rpartition(‘.’)
=> ["picture.2", ".", "jpg"]