From: Jack Dempsey Date: 2002-01-22T03:03:21+09:00 Subject: RE: Return the ASCII code ? i've always wondered what that question mark did :-) and i knew there had to be something simpler than 'a'[0] thanks! jack > -----Original Message----- > From: David Alan Black [mailto:dblack@candle.superlink.net] > Sent: Monday, January 21, 2002 1:00 PM > To: ruby-talk ML > Subject: Re: Return the ASCII code ? > > > Hello -- > > On Tue, 22 Jan 2002, D De Villiers wrote: > > > Hello! > > > > Newbie's question: > > > > In the Integer class you can return string containing the ASCII > character > > represented by the receiver's value: > > > > 65.chr -> "A" > > > > How can you get the ASCII code from a character ? With something like: > > > > "A".asc -> 65 > > > > The String class doesn't seam to have such a method (asc ?) or anything > > similar. > > Funny you should include that question mark :-) > > ruby -e 'puts ?a' > 97 > > > David > > -- > David Alan Black > home: dblack@candle.superlink.net > work: blackdav@shu.edu > Web: http://pirate.shu.edu/~blackdav > >