Kotaro Ezawa Kotaro Ezawa - 1 year ago 73
Ruby Question

Need help in trying to convert number into character code

I am using irb/ruby1.9.1/windows7.

I need to convert the letter "M" into character code.
I wrote the code below:


I expected the result to be
But the result was

How can I make the letter into character code?

Answer Source

Why not use ord

"M".ord #=> 77
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download