From: "David A. Black" Date: 2008-05-31T19:08:04+09:00 Subject: Re: splitting help needed Hi -- On Sat, 31 May 2008, 7stud -- wrote: > Siep Korteling wrote: >> The method split splits up a string and it will put the parts in an >> array. >> If you don't specify what to split on, it will split on newlines. Not >> what you want. How to make clear that you want to split on " "? >> Just say split(" ") . >> > > str = "hello world goodbye" > arr = str.split() > p arr > > --output:-- > ["hello", "world", "goodbye"] > > >> (split will also work with a regular expression, like in your code. It's >> faster > > Wrong. My benchmarks suggest that it's a little faster (about 10%). David -- Rails training from David A. Black and Ruby Power and Light: INTRO TO RAILS June 9-12 Berlin ADVANCING WITH RAILS June 16-19 Berlin See http://www.rubypal.com for details and updates!