Putting string values into array

I have a string that contians about 20 names that are all seperated by a
single white space. What is the easiest way to get those 20 names into
an array of 20 elements?

a = "first_name second_name third_name etc"

thanks

jack

···

--
Posted via http://www.ruby-forum.com/.

Alle Friday 21 November 2008, jackster the jackle ha scritto:

I have a string that contians about 20 names that are all seperated by a
single white space. What is the easiest way to get those 20 names into
an array of 20 elements?

a = "first_name second_name third_name etc"

thanks

jack

a.split ' '

Stefano

actually just

  a.split

is all you need.

-- Mark.

···

On Nov 21, 1:32 pm, Stefano Crocco <stefano.cro...@alice.it> wrote:

Alle Friday 21 November 2008, jackster the jackle ha scritto:

> I have a string that contians about 20 names that are all seperated by a
> single white space. What is the easiest way to get those 20 names into
> an array of 20 elements?

> a = "first_name second_name third_name etc"

> thanks

> jack

a.split ' '