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

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

On Nov 21, 1:32 pm, Stefano C. [email protected] wrote:

jack

a.split ’ ’

actually just

a.split

is all you need.

– Mark.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs