10.to_hex?


#1

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


#2

On Sat, Nov 19, 2005 at 11:32:25AM +0900, Daniel Sch?le wrote:

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/
=> []

ri sprintf

Search for ‘hex’.

(x and X)

marcel


#3

10.to_s(16) #=> a

class Numeric
def to_hex
to_s(16)
end
end

10.to_hex #=> a

On 11/18/05, Daniel Schüle removed_email_address@domain.invalid wrote:

Regards, Daniel


Tobi
http://jadedpixel.com - modern e-commerce software
http://typo.leetsoft.com - Open source weblog engine
http://blog.leetsoft.com - Technical weblog