Any suggestions on how to convert a Hex value to its decimal equivalent?
Have been coming up blank on this one. Thanks,
-S
···
--
Posted via http://www.ruby-forum.com/.
Any suggestions on how to convert a Hex value to its decimal equivalent?
Have been coming up blank on this one. Thanks,
-S
--
Posted via http://www.ruby-forum.com/.
Any suggestions on how to convert a Hex value to its decimal equivalent?
Have been coming up blank on this one. Thanks,
"ff".to_i(16)
=> 255
Regards,
Bill
From: "Shandy Nantz" <shandybleu@yahoo.com>
$ ruby -e 'puts "deaf".to_i(16)'
57007
robert
On 10.12.2007 19:09, Shandy Nantz wrote:
Any suggestions on how to convert a Hex value to its decimal equivalent?
Have been coming up blank on this one. Thanks,
Shandy Nantz wrote:
Any suggestions on how to convert a Hex value to its decimal equivalent?
Have been coming up blank on this one. Thanks,-S
'0xf'.hex
=> 15
--
Posted via http://www.ruby-forum.com/\.
Shandy Nantz wrote:
Any suggestions on how to convert a Hex value to its decimal equivalent?
Have been coming up blank on this one. Thanks,-S
This is what it is for base 16:
p 10.to_s(16)
=> 'a'
p 'a'.to_i(16)
=>10
Just use the base you want in the parens.
--
Posted via http://www.ruby-forum.com/\.
Ilan Berci wrote:
Shandy Nantz wrote:
Any suggestions on how to convert a Hex value to its decimal equivalent?
Have been coming up blank on this one. Thanks,-S
'0xf'.hex
=> 15
what about a base64 to a decimal? I have seen some examples using pack
and unpack but I'm not sure what they do? Thanks,
-S
--
Posted via http://www.ruby-forum.com/\.