From: Daniel Bretoi Date: 2002-07-31T06:25:04+09:00 Subject: Re: how to do typecasting? *smackself* I must be dizze since my last selfsmack.... thanks guys db On Wed, Jul 31, 2002 at 06:17:41AM +0900, Josh Huber wrote: > 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 -- "Then we typed the G, and the system crashed"...