Flowdock
rpartition(p1) public

Searches sep in the string from the end of the string, and returns the part before it, the sep, and the part after it. If sep is not found, returns two empty strings and str.

   "hello".rpartition("l")         #=> ["hel", "l", "o"]
   "hello".rpartition("x")         #=> ["", "", "hello"]
Show source
Register or log in to add new notes.
March 19, 2014 - (v1_8_6_287 - v1_9_3_392)
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"]