Convert an Character to the ASCII Character Code

J

John Gregory

I have Ruby 1.9.1p129 and I want to convert an ASCII character to an
Integer and a Float.

While reading the following web page, I found conflicts in the code
usage:

'Convert an Character to the ASCII Character Code'

Integer (?e)
=> 101

(then further down)

Float (?e)
=> 101.0

I received errors as per the attached screen snapshot.

I have found out that it is because I have version 1.9 and the above was
only workable in version 1.8.

I would still like to know how to get the same results using my current
version.

Thanks.

Attachments:
http://www.ruby-forum.com/attachment/3867/convert_error.jpeg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top