From: David Alan Black Date: 2002-07-05T11:09:33+09:00 Subject: Re: is there a better string.each? Hi -- On Fri, 5 Jul 2002, Dossy wrote: > On 2002.07.05, Tyler Spivey wrote: > > well, i have a bit of a problem: > > a="canada" > > a.each |i| > > do something > > end > > and, it doesn't loop over all the characters. is this normal? if so, > > how do i loop over all the characters? > > "canada".split(//).each { |i| p i } There's also String#each_byte, which will give you the numerical character codes. David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav