From: Josh Huber Date: 2002-07-31T06:17:41+09:00 Subject: Re: how to do typecasting? Daniel Bretoi 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