Convert an Character to the ASCII Character Code

Discussion in 'Ruby' started by John Gregory, Jul 5, 2009.

  1. John Gregory

    John Gregory Guest

    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

    --
    Posted via http://www.ruby-forum.com/.
     
    John Gregory, Jul 5, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. keithb
    Replies:
    1
    Views:
    7,035
    Bruce Barker
    Mar 15, 2006
  2. Replies:
    16
    Views:
    2,295
    Dave Thompson
    Mar 3, 2006
  3. Alextophi
    Replies:
    8
    Views:
    519
    Alan J. Flavell
    Dec 30, 2005
  4. bruce
    Replies:
    38
    Views:
    281
    Mark Lawrence
    Nov 1, 2013
  5. MRAB
    Replies:
    0
    Views:
    99
Loading...

Share This Page