From: Dirk Meijer Date: 2005-12-21T06:35:13+09:00 Subject: Re: iterate chars in a string ------=_Part_12592_335088.1135114501661 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline i've always used this: 0.upto(string.length-1) do |n| p string[n,1] end anything wrong with this? greetings, Dirk. 2005/12/20, Florian Gro=DF : > > Logan Capaldo wrote: > > > irb(main):015:0> str.scan(/./) do |character| > > irb(main):016:1* p character > > irb(main):017:1> end > > "H" > > "e" > > "l" > > "l" > > "o" > > "W" > > "o" > > "r" > > "l" > > "d" > > > > Where'd my newlines go? :( > > Heh, good point. Thanks for mentioning this. I think this might be quite > a common pit fall. > > Time to grep my code and see if this could possibly cause trouble > anywhere... > > -- > http://flgr.0x42.net/ > > > ------=_Part_12592_335088.1135114501661--