10.to_hex?

D

Daniel Schüle

Hello,

I can't find the function to convert an number to its hex representation
I feel it must be there ..

irb(main):068:0> Integer.methods.grep /hex/
=> []
irb(main):069:0> Numeric.methods.grep /hex/
=> []

Regards, Daniel
 
A

Ara.T.Howard

Hello,

I can't find the function to convert an number to its hex representation
I feel it must be there ..

irb(main):068:0> Integer.methods.grep /hex/
=> []
irb(main):069:0> Numeric.methods.grep /hex/
=> []

Regards, Daniel

harp:~ > ruby -e' p("%x" % 66) '
"42"


-a
--
===============================================================================
| ara [dot] t [dot] howard [at] gmail [dot] com
| all happiness comes from the desire for others to be happy. all misery
| comes from the desire for oneself to be happy.
| -- bodhicaryavatara
===============================================================================
 
T

Tobias Luetke

10.to_s(16) #=3D> a

class Numeric
def to_hex
to_s(16)
end
end

10.to_hex #=3D> a

Hello,

I can't find the function to convert an number to its hex representation
I feel it must be there ..

irb(main):068:0> Integer.methods.grep /hex/
=3D> []
irb(main):069:0> Numeric.methods.grep /hex/
=3D> []

Regards, Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,197
Messages
2,571,040
Members
47,634
Latest member
RonnyBoelk

Latest Threads

Top