Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

decimal value of an ASCII letter (See related posts)

converting a "A" to a 65:
   1  
   2  p 'A'[0]

Comments on this post

baumanj posts on Mar 31, 2006 at 21:24
There's actually a shorter, easier way:

   1  ?A
RobinHood posts on Feb 18, 2007 at 11:13
and to return it in hex use

   1   ?A.to_s(base=2) 


suggested by Gregarican found here ...
http://www.tek-tips.com/viewthread.cfm?qid=1026407&page=1

You need to create an account or log in to post comments to this site.


Click here to browse all 5556 code snippets

Related Posts