From: "Wesley J. Landaker" Date: 2002-11-15T01:56:36+09:00 Subject: Re: Integer to Hex Apparently, Shaun Smith recently wrote: > Hi, > Is there an easy way to get from an Integer to a hex representation > (i.e. the opposite of String#hex)? > Regards, > Shaun. There are lots of ways to do it; here is one way: x = 10 sprintf("%x", x) # -> "a" This is nice because you can get it in different forms: sprintf("0x%x", x) # -> "0xa" sprintf("0x%04x", x) # -> "0x000a" Simple and easy to use... assuming you think sprintf is simple and easy to use. ;)