From: 7stud -- Date: 2008-05-31T10:56:35+09:00 Subject: Re: splitting help needed 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. > and far more powerfull, but completely unreadable if you are not > familiar with it. In your code split("|") works.) > Ahh, but the governing principle in the Ruby community is to make a Ruby script look as much like a Perl script as possible--efficiency be damned. So who in their right mind would pass up a chance to use a hieroglyphic regex like: /\|/ in their code. That's art. -- Posted via http://www.ruby-forum.com/.