From: spooq Date: 2006-11-09T21:22:29+09:00 Subject: Re: thousand ways to rome Your version has no side-effect on the array, so it's not exactly the same as the original ... :) On 11/9/06, Bruno Michel wrote: > Chris Mueller a �crit : > > Hi, > > i am new to ruby and i am wondering how many more ways (and what ways) > > there are to do this: > > > > seperated_words = "hi, you, guys" > > words_array = seperated_words.split(",") > > for i in 0 ... words_array.length > > words_array[i] = words_array[i].strip > > end > > > > i suppose there's a one-liner that you write before you can think "ruby" > > doesn't it ??? > > > > thx, > > > > chris > > Hi, > > this is my version : > > "hi, you, guys".split(',').map { |word| word.strip } > => ["hi", "you", "guys"] > > -- > Bruno Michel > >