jduck tricked me on purpose.
git-svn-id: file:///home/svn/framework3/trunk@10222 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
e7aa1a86ec
commit
4388b886c8
|
@ -238,7 +238,7 @@ module Text
|
|||
def self.to_hex_ascii(str, prefix = "\\x", count = 1, suffix=nil)
|
||||
raise ::RuntimeError, "unable to chunk into #{count} byte chunks" if ((str.length % count) > 0)
|
||||
return str.unpack('H*')[0].gsub(Regexp.new(".{#{count * 2}}", nil, 'n')) { |s|
|
||||
(0x21..0x7e) === s.to_i(16) ? s.to_i(16).chr : prefix + s + suffix.to_s
|
||||
(0x20..0x7e) === s.to_i(16) ? s.to_i(16).chr : prefix + s + suffix.to_s
|
||||
}
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue