dblack / wobblini.net wrote:
> Hi --
> 
> On Sun, 24 Jun 2007, darren kirby wrote:
> 
>> quoth the Alex MacCaw:
>>> Does anyone have an example of splitting a name into first and last
>>> names? Or is just a case of doing string.split(' ')?
>>
>> I'd say a regexp is overkill here.
>>
>> irb(main):001:0> name = "Alex MacCaw"
>> => "Alex MacCaw"
>> irb(main):002:0> first, last = name.split
>> => ["Alex", "MacCaw"]
>> irb(main):003:0> first
>> => "Alex"
>> irb(main):004:0> last
>> => "MacCaw"
>>
>> Note that you will have to do more work to accommodate middle names and
>> titles, ie: Mr, Mrs, Dr etc...
> 
> And also last names with spaces in them (von Trapp, Vaughn Williams,
> etc.).
> 
And titles with spaces in them (The Honourable, His Excellency, etc...).

-- 
Alex