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?
----- Original Message -----
From: “Daniel Bretoi” lists@debonair.net
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Tuesday, July 30, 2002 4:13 PM
Subject: how to do typecasting?
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?