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

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -