From: 7stud -- Date: 2008-05-14T02:04:15+09:00 Subject: Re: How to convert character to hexadecimal? 7stud -- wrote: > Chris Hulan wrote: >> On May 13, 9:57 am, I�aki Baz Castillo wrote: >>> Great ! >>> >>> -- >>> I�aki Baz Castillo >>> >> >> I think ' '[0].to_s.hex will produce the value and be a bit easier to >> read. YMMV >> For example: >> x = " \tX" >> 0.upto(x.size-1){|i| puts "x%02x"%x[i].to_s.hex} >> > Your problems are a direct result of ... ..and the hex method having a misleading name. Why anyone would call a method 'hex' whose return value is a decimal number is hard to comprehend. -- Posted via http://www.ruby-forum.com/.