I am in a situation where I need the ASCII value of a character (for Project Euler question # 22 , if you want to get it), and I ran into a problem.
Being new to rubies, I searched for it and found that ? Is this the way ?A or something else. But when I include it in my code, the result of this statement is the character string "A" -no. Same problem with [0] and slice(0) , both of which should theoretically return ASCII code.
The only thing I can think of is the problem with the ruby ββversion. I am using 1.9.1-p0 updated with 1.8.6 in the afternoon. I changed the work with the working version of Ruby a bit, in the same directory, I assumed that I probably already have files that are not included in the package .zip file, so I did not download them.
So why exactly are all my ASCII codes converted to valid characters?
ruby char ascii
dorr Aug 13 '09 at 5:41 2009-08-13 05:41
source share