Ruby rpartition vs partition? -
what difference between rpartition , partition? have read documentation see them same. ones came in later ruby version?
the following example identify difference:
"abccba".partition("b") # => ["a", "b", "ccba"] "abccba".rpartition("b") # => ["abcc", "b", "a"] so difference rpartition searches rightmost occurrence, instead of leftmost one.
Comments
Post a Comment