From: Aaron Patterson Date: 2009-07-06T08:13:12+09:00 Subject: Re: Convert an Character to the ASCII Character Code On Mon, Jul 06, 2009 at 07:32:38AM +0900, John Gregory wrote: > 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. How about this: "e".getbyte(0) and: "e".getbyte(0).to_f -- Aaron Patterson http://tenderlovemaking.com/