Topic: string to array

hey all,
I have a string that looks like that:

'somevalue,someothervalue,yetanothervalue' and I would like to turn it into an array that would look like that: ['somevalue','someothervalue','yetanothervalue']

any idea?

thanx in advance

Pat

Re: string to array

Try:

'somevalue,someothervalue,yetanothervalue'.split(',')

Railscasts - Free Ruby on Rails Screencasts

Re: string to array

ok thanx a lot, and do you know how I can insert a string inside of another string?
say I have str='abce' and I would like to insert a 'd' inside of that string to get str='abcde'?

thanx in advance

Pat

Re: string to array

There's the insert method:

str.insert(3, 'd')

Railscasts - Free Ruby on Rails Screencasts