From: "Berger, Daniel" Date: 2006-03-21T04:51:32+09:00 Subject: Re: iterate chars in a string > -----Original Message----- > From: Mike Austin [mailto:noone@nowhere.com] > Sent: Monday, March 20, 2006 12:39 PM > To: ruby-talk ML > Subject: Re: iterate chars in a string > > > "I am puzzled".each_byte { |b| puts b.chr } > > I'm surprised that not many people knew about 'each_byte()'. > Maybe it's a > problem with Ruby docs? Or maybe it is just > counter-intuitive - I would expect > each() iterate over bytes, and provide each_lines() to > iterate over lines instead. > > Mike > > http://www.rubycentral.com/ref/ Modifying String#to_a to return an array of characters has been brought up before (ruby-talk:148588 and following). I don't think Matz likes the idea, though. Dan