Implement str.partition and add tests for it.
Implement str.rpartition and add tests for it.
str.(r)partition: factor out duplicate code.

Switch str.rpartition to search from left to right. Factor the
duplicate code into one helper function.
Merge pull request #351 from xbe/str-partition

Implement str.partition and add tests for it.