[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: How to convert a String to an Array?

Farrel Lifson

3/16/2007 12:24:00 PM

On 16/03/07, RubyCrazy <rubycrazy@gmail.com> wrote:
> Is there a way to convert a String to an Array? I could only find the
> following -
> 'hello world'.scan(/./)
>
> Thanks.
>

irb(main):001:0> "hello world".split(//)
=> ["h", "e", "l", "l", "o", " ", "w", "o", "r", "l", "d"]

I'm not sure if this is functionally the same or if there is some kind
of performance boost using split instead of scan.

Farrel