From: Tim Conner Date: 2008-01-11T02:27:33+09:00 Subject: Re: Question about Hex => Signed Int Gary Wright wrote: > The tricky part is dealing with the twos compliment notation but > String#to_i will do the hex/decimal conversion: > > >> "0xFF467A7B".to_i(16) - 0x100000000 > => -12158341 > > >> "0x38CFEF".to_i(16) > => 3723247 > > Gary Wright Thanks for that. Is there a ruby function which I can pass a hex number and it works out if it is +/- and then returns the correct decimal value? -- Posted via http://www.ruby-forum.com/.