Robert Klemme
5/10/2007 3:35:00 PM
On 10.05.2007 17:23, Todd Burch wrote:
> Note, the version I'm showing has the backslash. It fails with or
> without it. (and I'm not even certain that \> is even valid!!)
>> '\>'
=> "\\>"
>> '>'
=> ">"
The backslash is wrong there.
A more robust way to code this would be to use a HashMap - at least to
initially associate ASCII with EBCDIC chars. So, I'd rather to
CHAR_MAP = {
0XC1 => ?A,
0xC2 => ?B,
# ...
}
Then you can do:
ebcdic, ascii = [CHAR_MAP.keys, CHAR_MAP.values].map do |set|
set.inject("") {|st, ch| st << ch}
end
Kind regards
robert