[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Array.join for nested arrays

freeunli

6/28/2007 6:37:00 PM

Doing

arr = [1, [2, [3, 4], 5], 6]
arr.join(',')

in Ruby 1.8.6 produces the following string:

1,2,3,4,5,6

Looking at the docs (e.g. http://www.noobkit.com/ruby-...),
Array.join should work as following:

"Returns a string created by converting each element of the array to a
string, separated by sep."

Doing the following:

arr.each do |e|


However, this is not what I expected - I would have expected: