Gordon Thiesfeld
10/23/2007 3:22:00 PM
> So... best way to do the conversion, and best way to do the search.
> Ideas?
>
> Earle
Here's a way to do the conversion. No ideas on the search.
class String
def to_hex_string
r = ''
self.each_byte{|c| r << c.to_s(16)}
r
end
end
# unit test
require 'test/unit'
class TestString < Test::Unit::TestCase
def test_convert
assert_equal( '52494646', 'RIFF'.to_hex_string)
end
end
Regards,
Gordon