hello,
there are a few questions after I've read the
manual...
``String.hex´´ converts a hex-string to a decimal
number. But how to convert a decimal number to a
hex value?
If I do
begin
...
rescue
...
end
catches the rescue part every error?
I can also write ``rescue StandardError, SyntaxError, ...
greetings,
mark
mark greenlancer wrote:
hello,
Moin!
there are a few questions after I've read the
manual...
``String.hex´´ converts a hex-string to a decimal
number. But how to convert a decimal number to a
hex value?
I think that String#hex should not be used anymore.
I would use "deadbeef".to_i(16) for converting from a String to a number and 36.to_s(16) for the other way.
If I do
begin
...
rescue
...
end
catches the rescue part every error?
I can also write ``rescue StandardError, SyntaxError, ...
It is the same as 'rescue StandardError' -- if you want to rescue all errors you should use 'rescue Exception' instead.
greetings,
mark
Regards,
Florian Gross
number.to_s(16)
It works for other bases too 
martin
···
mark greenlancer <markgreenlancer@aon.at> wrote:
hello,
there are a few questions after I've read the
manual...
``String.hex´´ converts a hex-string to a decimal
number. But how to convert a decimal number to a
hex value?