[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Shandy Nantz

2/28/2008 3:43:00 PM

I am trying to convert some vb script code to its Ruby counterpart and
there is a function in the script which converts an expression to a long
data type and my question is, is there a way to do the same thing in
Ruby. I had been using to_i but I'm not sure if that is correct. Thanks,

-S
--
Posted via http://www.ruby-....

1 Answer

Mark Bush

2/28/2008 4:05:00 PM

0

Shandy Nantz wrote:
> I am trying to convert some vb script code to its Ruby counterpart and
> there is a function in the script which converts an expression to a long
> data type and my question is, is there a way to do the same thing in
> Ruby. I had been using to_i but I'm not sure if that is correct. Thanks,

Depends what your "expression" is. In Ruby, there's no need to worry
about how big an integer is. Different subclasses of Integer are used
to handle integers of different magnitudes, but that is transparent, so:

a = "123".to_i
=> 123
a.class
=> Fixnum

a = "248578913250896781364890374857878134".to_i
=> 248578913250896781364890374857878134
a.class
=> Bignum

Remember that the variable is just a name pointing to an object and can
point to any object of any class.

--
Posted via http://www.ruby-....