Hi --

On Fri, 5 Jul 2002, Dossy wrote:

> On 2002.07.05, Tyler Spivey <tspivey8 / telus.net> 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