Daniel Bretoi <lists / debonair.net> writes:

> is there a way to typecast values? 
> if I have an array with numbers, and I want to perform sting type
> methods on it.
>
> a = [1,2,4345,3]
> a.each { |l| print l.length }
> to produce
> >>  1141
>
> besides defining a as ["1","2",etc], what options are there?

a.each { |v|
       print v.to_s.length
}

a = %w[1 2 4345 3]
=> ["1", "2", "4345", "3"]

hth,

-- 
Josh Huber