Peña, Botp
2/12/2008 1:54:00 AM
From: John Maclean [mailto:info@jayeola.org]=20
# Where can I find out more about that method within ri?
# ri Object?
judging fr stud's reply, maybe you can try the string object first, eg,
botp@pc4all:~$ qri to_i
------------------------------------------------------ Multiple choices:
Class#to_i, Float#to_i, IO#to_i, IPAddr#to_i, Integer#to_i,
NilClass#to_i, Process::Status#to_i, Rational#to_i, String#to_i,
Symbol#to_i, Time#to_i
botp@pc4all:~$ qri string.to_i
------------------------------------------------------------ String#to_i
str.to_i(base=3D10) =3D> integer
------------------------------------------------------------------------
Returns the result of interpreting leading characters in str as an
integer base base (2, 8, 10, or 16). Extraneous characters past
the end of a valid number are ignored. If there is not a valid
number at the start of str, 0 is returned. This method never
raises an exception.
"12345".to_i #=3D> 12345
"99 red balloons".to_i #=3D> 99
"0a".to_i #=3D> 0
"0a".to_i(16) #=3D> 10
"hello".to_i #=3D> 0
"1100101".to_i(2) #=3D> 101
"1100101".to_i(8) #=3D> 294977
"1100101".to_i(10) #=3D> 1100101
"1100101".to_i(16) #=3D> 17826049
botp@pc4all:~$
kind regards -botp