On Feb 2, 10:55 am, Rob Biedenharn <R... / AgileConsultingLLC.com>
wrote:
> On Feb 1, 2007, at 11:10 PM, Chris Shea wrote:

> Good solutions already, but I had to chime in with one less clever
> and without regexps.
> I also didn't like "halve" as a name so I used "cleave".
>
> Enjoy!
>
> class String
>    def cleave
>      middle = self.length/2
>      early = self.rindex(' ', middle)
>      late = self.index(' ', middle)

[snip]

This is nice and versitle. One good augmentation might be...

    def cleave(middle=nil)
      middle ||= self.length/2

T.